baseaudiosink: subtract the render_delay from our latency

The latency reported by the base class includes the render_delay, which we don't
want to include when we start slaving our clocks.

See #630441
This commit is contained in:
Wim Taymans 2010-09-24 12:54:47 +02:00
parent 550d59354f
commit c89082b2dd

View file

@ -1145,7 +1145,7 @@ gst_base_audio_sink_sync_latency (GstBaseSink * bsink, GstMiniObject * obj)
{
GstClock *clock;
GstClockReturn status;
GstClockTime time;
GstClockTime time, render_delay;
GstFlowReturn ret;
GstBaseAudioSink *sink;
GstClockTime itime, etime;
@ -1175,6 +1175,15 @@ gst_base_audio_sink_sync_latency (GstBaseSink * bsink, GstMiniObject * obj)
time = sink->priv->us_latency;
GST_OBJECT_UNLOCK (sink);
/* Renderdelay is added onto our own latency, and needs
* to be subtracted as well */
render_delay = gst_base_sink_get_render_delay (bsink);
if (G_LIKELY (time > render_delay))
time -= render_delay;
else
time = 0;
/* preroll done, we can sync since we are in PLAYING now. */
GST_DEBUG_OBJECT (sink, "possibly waiting for clock to reach %"
GST_TIME_FORMAT, GST_TIME_ARGS (time));