jitterbuffer: reset is only possible with a GAP

This commit is contained in:
Wim Taymans 2013-08-01 11:40:41 +02:00
parent f864131227
commit 9d88ac9cbb

View file

@ -1352,10 +1352,11 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent,
/* now check against our expected seqnum */ /* now check against our expected seqnum */
if (G_LIKELY (priv->next_in_seqnum != -1)) { if (G_LIKELY (priv->next_in_seqnum != -1)) {
gint gap; gint gap;
gboolean reset = FALSE;
gap = gst_rtp_buffer_compare_seqnum (priv->next_in_seqnum, seqnum); gap = gst_rtp_buffer_compare_seqnum (priv->next_in_seqnum, seqnum);
if (G_UNLIKELY (gap != 0)) { if (G_UNLIKELY (gap != 0)) {
gboolean reset = FALSE;
GST_DEBUG_OBJECT (jitterbuffer, "expected #%d, got #%d, gap of %d", GST_DEBUG_OBJECT (jitterbuffer, "expected #%d, got #%d, gap of %d",
priv->next_in_seqnum, seqnum, gap); priv->next_in_seqnum, seqnum, gap);
/* priv->next_in_seqnum >= seqnum, this packet is too late or the /* priv->next_in_seqnum >= seqnum, this packet is too late or the
@ -1372,7 +1373,6 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent,
} else { } else {
GST_DEBUG_OBJECT (jitterbuffer, "tolerable gap"); GST_DEBUG_OBJECT (jitterbuffer, "tolerable gap");
} }
}
if (G_UNLIKELY (reset)) { if (G_UNLIKELY (reset)) {
GST_DEBUG_OBJECT (jitterbuffer, "flush and reset jitterbuffer"); GST_DEBUG_OBJECT (jitterbuffer, "flush and reset jitterbuffer");
rtp_jitter_buffer_flush (priv->jbuf); rtp_jitter_buffer_flush (priv->jbuf);
@ -1382,6 +1382,7 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent,
priv->next_seqnum = seqnum; priv->next_seqnum = seqnum;
} }
} }
}
priv->next_in_seqnum = (seqnum + 1) & 0xffff; priv->next_in_seqnum = (seqnum + 1) & 0xffff;
/* let's check if this buffer is too late, we can only accept packets with /* let's check if this buffer is too late, we can only accept packets with