summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2018-08-17 14:56:51 +0300
committerSebastian Dröge <sebastian@centricular.com>2018-08-17 16:40:16 +0300
commit186870d10ad58c2dc95f5f50a16f29bc1f47bd51 (patch)
treec2b10f51328067404a969464fb54d655762f2e8a
parentff952374b5b7961fd45bc3fb5218e212cae9f434 (diff)
audiobuffersplit: Update output buffer size after each buffer to compensate for accumulated errors
https://bugzilla.gnome.org/show_bug.cgi?id=796981
-rw-r--r--gst/audiobuffersplit/gstaudiobuffersplit.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gst/audiobuffersplit/gstaudiobuffersplit.c b/gst/audiobuffersplit/gstaudiobuffersplit.c
index fd3f8091f..d73e391da 100644
--- a/gst/audiobuffersplit/gstaudiobuffersplit.c
+++ b/gst/audiobuffersplit/gstaudiobuffersplit.c
@@ -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;