summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiago.sousa.santos@collabora.com>2014-11-28 14:36:23 -0300
committerTim-Philipp Müller <tim@centricular.com>2015-06-10 19:27:23 +0100
commitec4f2fa5dbd8a00e82ec8438796c3df916235208 (patch)
treea5273c21d5694299cec1d26b81e823c2954243ae
parent9204caa2208c323e9994c535e650f8e948595937 (diff)
downloadgstreamer-plugins-base-ec4f2fa5dbd8a00e82ec8438796c3df916235208.tar.gz
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
-rw-r--r--gst-libs/gst/audio/gstaudiobasesink.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gst-libs/gst/audio/gstaudiobasesink.c b/gst-libs/gst/audio/gstaudiobasesink.c
index df313dc76..8baa7fe74 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 */