audiomixer: Fix discont detection and buffer alignment code
authorSebastian Dröge <sebastian@centricular.com>
Thu, 12 Mar 2015 17:11:31 +0000 (17:11 +0000)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 12 Mar 2015 17:14:33 +0000 (17:14 +0000)
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

index 973abc7eed41b3ea4386b5be9315b31f9ce38da9..fe1e3e04ec9c005e5cef25600537787fdba379f6 100644 (file)
@@ -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;