From 0e6b9e596d88b34098bc069bef1eced3b9b97a47 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 18 Nov 2009 17:09:28 +0100 Subject: [PATCH] baseaudiosink: fix initial calibration When we are calibrating the internal clock against the external clock take into account the time offset applied to our internal clock because we will subtract that in the render_function again. --- gst-libs/gst/audio/gstbaseaudiosink.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gst-libs/gst/audio/gstbaseaudiosink.c b/gst-libs/gst/audio/gstbaseaudiosink.c index d84c6f6..a4d2dc8 100644 --- a/gst-libs/gst/audio/gstbaseaudiosink.c +++ b/gst-libs/gst/audio/gstbaseaudiosink.c @@ -295,6 +295,7 @@ gst_base_audio_sink_init (GstBaseAudioSink * baseaudiosink, if (strcmp (gst_plugin_feature_get_name (feature), "pulsesink") == 0) { if (!gst_plugin_feature_check_version (feature, 0, 10, 17)) { /* we're dealing with an old pulsesink, we need to disable time corection */ + GST_DEBUG ("disable time offset"); baseaudiosink->priv->do_time_offset = FALSE; } } @@ -1196,6 +1197,7 @@ gst_base_audio_sink_sync_latency (GstBaseSink * bsink, GstMiniObject * obj) * time of the external clock) */ etime = GST_ELEMENT_CAST (sink)->base_time + time; itime = gst_audio_clock_get_time (sink->provided_clock); + itime = gst_audio_clock_adjust (sink->provided_clock, itime); if (status == GST_CLOCK_EARLY) { /* when we prerolled late, we have to take into account the lateness */ @@ -1457,10 +1459,16 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf) &render_start, &render_stop); } + GST_DEBUG_OBJECT (sink, + "final timestamps: start %" GST_TIME_FORMAT " - stop %" GST_TIME_FORMAT, + GST_TIME_ARGS (render_start), GST_TIME_ARGS (render_stop)); + /* bring to position in the ringbuffer */ if (sink->priv->do_time_offset) { time_offset = GST_AUDIO_CLOCK_CAST (sink->provided_clock)->abidata.ABI.time_offset; + GST_DEBUG_OBJECT (sink, + "time offset %" GST_TIME_FORMAT, GST_TIME_ARGS (time_offset)); if (render_start > time_offset) render_start -= time_offset; else -- 2.7.4