From edcc5be297f03c0152ebabbba1fe0bfad8a5131a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 22 Apr 2015 20:24:20 +0200 Subject: [PATCH] rtpjitterbuffer: When request retransmissions for future packets, consider the packet spacing in the extra delay We now take the maximum of 2*jitter and 0.5*packet_spacing for the extra delay. If jitter is very low, this should prevent unnecessary retransmission requests to some degree. https://bugzilla.gnome.org/show_bug.cgi?id=748041 --- gst/rtpmanager/gstrtpjitterbuffer.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c index 673713e..ded09c1 100644 --- a/gst/rtpmanager/gstrtpjitterbuffer.c +++ b/gst/rtpmanager/gstrtpjitterbuffer.c @@ -1889,11 +1889,13 @@ get_rtx_delay (GstRtpJitterBufferPrivate * priv) GstClockTime delay; if (priv->rtx_delay == -1) { - if (priv->avg_jitter == 0) + if (priv->avg_jitter == 0 && priv->packet_spacing == 0) { delay = DEFAULT_AUTO_RTX_DELAY; - else - /* jitter is in nanoseconds, 2x jitter is a good margin */ - delay = priv->avg_jitter * 2; + } else { + /* jitter is in nanoseconds, maximum of 2x jitter and half the + * packet spacing is a good margin */ + delay = MAX (priv->avg_jitter * 2, priv->packet_spacing / 2); + } } else { delay = priv->rtx_delay * GST_MSECOND; } -- 2.7.4