audiobuffersplit: Update output buffer size after each buffer to compensate for accumulated errors
https://bugzilla.gnome.org/show_bug.cgi?id=796981
diff --git a/gst/audiobuffersplit/gstaudiobuffersplit.c b/gst/audiobuffersplit/gstaudiobuffersplit.c
index e2a4167..225fb9b 100644
--- a/gst/audiobuffersplit/gstaudiobuffersplit.c
+++ b/gst/audiobuffersplit/gstaudiobuffersplit.c
@@ -381,6 +381,13 @@
ret = gst_pad_push (self->srcpad, buffer);
if (ret != GST_FLOW_OK)
break;
+
+ /* Update the size based on the accumulated error we have now after
+ * taking out a buffer. Same code as above */
+ size = samples_per_buffer * bpf;
+ if (self->error_per_buffer + self->accumulated_error >=
+ self->output_buffer_duration_d)
+ size += bpf;
}
return ret;