audiobuffersplit: Update output buffer size after each buffer to compensate for accum...
authorSebastian Dröge <sebastian@centricular.com>
Fri, 17 Aug 2018 11:56:51 +0000 (14:56 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Fri, 17 Aug 2018 13:40:16 +0000 (16:40 +0300)
https://bugzilla.gnome.org/show_bug.cgi?id=796981

gst/audiobuffersplit/gstaudiobuffersplit.c

index fd3f809..d73e391 100644 (file)
@@ -385,6 +385,13 @@ gst_audio_buffer_split_output (GstAudioBufferSplit * self, gboolean force,
     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;