From 05bd708fc5e881390fe839803b53144393d95ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Par=C3=ADs=20D=C3=ADaz?= Date: Tue, 4 Nov 2014 15:00:52 +0100 Subject: [PATCH] rtpjitterbuffer: Fix expected_dts calc in calculate_expected Right above we consider lost_packet packets, each of them having duration, as lost and triggered their timers immediately. Below we use expected_dts to schedule retransmission or schedule lost timers for the packets that come after expected_dts. As we just triggered lost_packets packets as lost, there's no point in scheduling new timers for them and we can just skip over all lost packets. https://bugzilla.gnome.org/show_bug.cgi?id=739868 --- gst/rtpmanager/gstrtpjitterbuffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c index 6c3c9b8def..937d50e3a3 100644 --- a/gst/rtpmanager/gstrtpjitterbuffer.c +++ b/gst/rtpmanager/gstrtpjitterbuffer.c @@ -2004,6 +2004,7 @@ calculate_expected (GstRtpJitterBuffer * jitterbuffer, guint32 expected, GstRtpJitterBufferPrivate *priv = jitterbuffer->priv; GstClockTime total_duration, duration, expected_dts; TimerType type; + guint lost_packets = 0; GST_DEBUG_OBJECT (jitterbuffer, "dts %" GST_TIME_FORMAT ", last %" GST_TIME_FORMAT, @@ -2025,7 +2026,6 @@ calculate_expected (GstRtpJitterBuffer * jitterbuffer, guint32 expected, if (total_duration > priv->latency_ns) { GstClockTime gap_time; - guint lost_packets; gap_time = total_duration - priv->latency_ns; @@ -2052,7 +2052,7 @@ calculate_expected (GstRtpJitterBuffer * jitterbuffer, guint32 expected, priv->last_in_dts += gap_time; } - expected_dts = priv->last_in_dts + duration; + expected_dts = priv->last_in_dts + (lost_packets + 1) * duration; if (priv->do_retransmission) { TimerData *timer;