From e4b2360e6e5bff335a6b688a03a2385bcb8ea9c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 9 Dec 2015 12:24:09 +0200 Subject: [PATCH] rtpjitterbuffer: Fix packet dropping after a big discont We would queue 5 consective packets before considering a reset and a proper discont here. Instead of expecting the next output packet to have the current seqnum (i.e. the fifth), expect it to have the first seqnum. Otherwise we're going to drop all queued up packets. --- gst/rtpmanager/gstrtpjitterbuffer.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c index 55161b4236..1349e32944 100644 --- a/gst/rtpmanager/gstrtpjitterbuffer.c +++ b/gst/rtpmanager/gstrtpjitterbuffer.c @@ -2602,7 +2602,17 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent, remove_all_timers (jitterbuffer); priv->discont = TRUE; priv->last_popped_seqnum = -1; - priv->next_seqnum = seqnum; + + if (priv->gap_packets.head) { + GstBuffer *gap_buffer = priv->gap_packets.head->data; + GstRTPBuffer gap_rtp = GST_RTP_BUFFER_INIT; + + gst_rtp_buffer_map (gap_buffer, GST_MAP_READ, &gap_rtp); + priv->next_seqnum = gst_rtp_buffer_get_seq (&gap_rtp); + gst_rtp_buffer_unmap (&gap_rtp); + } else { + priv->next_seqnum = seqnum; + } priv->last_in_dts = -1; priv->next_in_seqnum = -1;