From 243730ced44e61997f5338007ccc3c3dae6f337a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 8 Jul 2015 15:13:17 +0300 Subject: [PATCH] rtpjitterbuffer: Handle seqnum gaps in TCP streams without erroring out or overflowing calculations That is, handle DTS==GST_CLOCK_TIME_NONE correctly. https://bugzilla.gnome.org/show_bug.cgi?id=749536 --- gst/rtpmanager/gstrtpjitterbuffer.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c index 3240089..079cac3 100644 --- a/gst/rtpmanager/gstrtpjitterbuffer.c +++ b/gst/rtpmanager/gstrtpjitterbuffer.c @@ -2030,7 +2030,7 @@ update_timers (GstRtpJitterBuffer * jitterbuffer, guint16 seqnum, } } - if (do_next_seqnum) { + if (do_next_seqnum && dts != GST_CLOCK_TIME_NONE) { GstClockTime expected, delay; /* calculate expected arrival time of the next seqnum */ @@ -2106,6 +2106,10 @@ calculate_expected (GstRtpJitterBuffer * jitterbuffer, guint32 expected, "dts %" GST_TIME_FORMAT ", last %" GST_TIME_FORMAT, GST_TIME_ARGS (dts), GST_TIME_ARGS (priv->last_in_dts)); + /* Nothing to be done here if we don't get packet receive times */ + if (dts == GST_CLOCK_TIME_NONE) + return; + /* the total duration spanned by the missing packets */ if (dts >= priv->last_in_dts) total_duration = dts - priv->last_in_dts; @@ -2449,12 +2453,7 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent, } else { gboolean reset = FALSE; - if (!GST_CLOCK_TIME_IS_VALID (dts)) { - /* We would run into calculations with GST_CLOCK_TIME_NONE below - * and can't compensate for anything without DTS on RTP packets - */ - goto gap_but_no_dts; - } else if (gap < 0) { + if (gap < 0) { /* we received an old packet */ if (G_UNLIKELY (gap != -1 && gap < -RTP_MAX_MISORDER)) { reset = @@ -2707,15 +2706,6 @@ duplicate: free_item (item); goto finished; } -gap_but_no_dts: - { - /* this is fatal as we can't compensate for gaps without DTS */ - GST_ELEMENT_ERROR (jitterbuffer, STREAM, DECODE, (NULL), - ("Received packet without DTS after a gap")); - gst_buffer_unref (buffer); - ret = GST_FLOW_ERROR; - goto finished; - } } static GstClockTime -- 2.7.4