From e996f73d0cc71311b6058f2ec8bc276dbb777e2b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 27 Dec 2013 15:57:39 +0100 Subject: [PATCH] jitterbuffer: take more accurate running-time for NACK Don't use the current time calculated from the tmieout loop for when we last scheduled the NACK because it might be unscheduled because of a max packet misorder and then we don't accurately calculate the current time. Instead, take the current element running time using the clock. --- gst/rtpmanager/gstrtpjitterbuffer.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c index 464bb09ddd..85dad3be94 100644 --- a/gst/rtpmanager/gstrtpjitterbuffer.c +++ b/gst/rtpmanager/gstrtpjitterbuffer.c @@ -2490,6 +2490,7 @@ do_expected_timeout (GstRtpJitterBuffer * jitterbuffer, TimerData * timer, GstRtpJitterBufferPrivate *priv = jitterbuffer->priv; GstEvent *event; guint delay; + GstClock *clock; GST_DEBUG_OBJECT (jitterbuffer, "expected %d didn't arrive", timer->seqnum); @@ -2507,7 +2508,15 @@ do_expected_timeout (GstRtpJitterBuffer * jitterbuffer, TimerData * timer, priv->num_rtx_requests++; timer->num_rtx_retry++; - timer->rtx_last = now; + + GST_OBJECT_LOCK (jitterbuffer); + if ((clock = GST_ELEMENT_CLOCK (jitterbuffer))) { + timer->rtx_last = gst_clock_get_time (clock); + timer->rtx_last -= GST_ELEMENT_CAST (jitterbuffer)->base_time; + } else { + timer->rtx_last = now; + } + GST_OBJECT_UNLOCK (jitterbuffer); /* calculate the timeout for the next retransmission attempt */ timer->rtx_retry += (priv->rtx_retry_timeout * GST_MSECOND);