From ef580889e03d223d64dbc5a2d847ba91c42dac0d Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Fri, 28 Nov 2014 14:36:23 -0300 Subject: [PATCH] audiobasesink: get the internal time before the clock reset Otherwise calls to get the clock time might change its internal state and the internal/external time for calibration get unbalanced leading to a clock jump https://bugzilla.gnome.org/show_bug.cgi?id=740834 --- gst-libs/gst/audio/gstaudiobasesink.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/audio/gstaudiobasesink.c b/gst-libs/gst/audio/gstaudiobasesink.c index 3510754de2..6f3bad9484 100644 --- a/gst-libs/gst/audio/gstaudiobasesink.c +++ b/gst-libs/gst/audio/gstaudiobasesink.c @@ -843,7 +843,7 @@ gst_audio_base_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) { GstAudioBaseSink *sink = GST_AUDIO_BASE_SINK (bsink); GstAudioRingBufferSpec *spec; - GstClockTime now; + GstClockTime now, internal_time; GstClockTime crate_num, crate_denom; if (!sink->ringbuffer) @@ -864,6 +864,7 @@ gst_audio_base_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) * gst_audio_clock_reset() which will use this last_time to create an offset * so that time from the clock keeps on increasing monotonically. */ now = gst_clock_get_time (sink->provided_clock); + internal_time = gst_clock_get_internal_time (sink->provided_clock); GST_DEBUG_OBJECT (sink, "time was %" GST_TIME_FORMAT, GST_TIME_ARGS (now)); @@ -899,8 +900,7 @@ gst_audio_base_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) gst_clock_get_calibration (sink->provided_clock, NULL, NULL, &crate_num, &crate_denom); gst_clock_set_calibration (sink->provided_clock, - gst_clock_get_internal_time (sink->provided_clock), now, crate_num, - crate_denom); + internal_time, now, crate_num, crate_denom); /* calculate actual latency and buffer times. * FIXME: In 2.0, store the latency_time internally in ns */