Commit c89082b2 authored by Wim Taymans's avatar Wim Taymans
Browse files

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
parent 550d5935
......@@ -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));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment