From 25d8f76ecdc208b93f6b20a053e67cfad64763e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 12 Mar 2015 17:11:31 +0000 Subject: [PATCH] audiomixer: Fix discont detection and buffer alignment code Actually accumulate the sample counter to check the accumulated error between actual timestamps and expected ones instead of just resetting the error back to 0 with every new buffer. Also don't reset discont_time whenever we don't resync. The whole point of discont_time is to remember when we first detected a discont until we actually act on it a bit later if the discont stayed around for discont_wait time. https://bugzilla.gnome.org/show_bug.cgi?id=746032 --- gst/audiomixer/gstaudiomixer.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gst/audiomixer/gstaudiomixer.c b/gst/audiomixer/gstaudiomixer.c index 973abc7eed..fe1e3e04ec 100644 --- a/gst/audiomixer/gstaudiomixer.c +++ b/gst/audiomixer/gstaudiomixer.c @@ -1058,12 +1058,11 @@ gst_audio_mixer_fill_buffer (GstAudioMixer * audiomixer, GstAudioMixerPad * pad, G_GUINT64_FORMAT ", got %" G_GUINT64_FORMAT, pad->next_offset, start_offset); pad->output_offset = -1; + pad->next_offset = end_offset; } else { - pad->discont_time = GST_CLOCK_TIME_NONE; + pad->next_offset += pad->size / bpf; } - pad->next_offset = end_offset; - if (pad->output_offset == -1) { GstClockTime start_running_time; GstClockTime end_running_time;