rtpjitterbuffer: detect -1 seqnum

Keep the seqnum as a full guint so that we can check for -1 entries and
deal with them correctly.
Immediately try to push -1 seqnum.
This commit is contained in:
Wim Taymans 2013-12-10 11:04:06 +01:00
parent 4a2e0f4ff4
commit 36e78bc5ca

View file

@ -2268,7 +2268,7 @@ update_estimated_eos (GstRtpJitterBuffer * jitterbuffer,
/* take a buffer from the queue and push it */ /* take a buffer from the queue and push it */
static GstFlowReturn static GstFlowReturn
pop_and_push_next (GstRtpJitterBuffer * jitterbuffer, guint16 seqnum) pop_and_push_next (GstRtpJitterBuffer * jitterbuffer, guint seqnum)
{ {
GstRtpJitterBufferPrivate *priv = jitterbuffer->priv; GstRtpJitterBufferPrivate *priv = jitterbuffer->priv;
GstFlowReturn result; GstFlowReturn result;
@ -2324,8 +2324,10 @@ pop_and_push_next (GstRtpJitterBuffer * jitterbuffer, guint16 seqnum)
/* now we are ready to push the buffer. Save the seqnum and release the lock /* now we are ready to push the buffer. Save the seqnum and release the lock
* so the other end can push stuff in the queue again. */ * so the other end can push stuff in the queue again. */
priv->last_popped_seqnum = seqnum; if (seqnum != -1) {
priv->next_seqnum = (seqnum + item->count) & 0xffff; priv->last_popped_seqnum = seqnum;
priv->next_seqnum = (seqnum + item->count) & 0xffff;
}
JBUF_UNLOCK (priv); JBUF_UNLOCK (priv);
item->data = NULL; item->data = NULL;
@ -2374,7 +2376,7 @@ handle_next_buffer (GstRtpJitterBuffer * jitterbuffer)
GstRtpJitterBufferPrivate *priv = jitterbuffer->priv; GstRtpJitterBufferPrivate *priv = jitterbuffer->priv;
GstFlowReturn result = GST_FLOW_OK; GstFlowReturn result = GST_FLOW_OK;
RTPJitterBufferItem *item; RTPJitterBufferItem *item;
guint16 seqnum; guint seqnum;
guint32 next_seqnum; guint32 next_seqnum;
gint gap; gint gap;
@ -2394,6 +2396,8 @@ again:
/* get the seqnum and the next expected seqnum */ /* get the seqnum and the next expected seqnum */
seqnum = item->seqnum; seqnum = item->seqnum;
if (seqnum == -1)
goto do_push;
next_seqnum = priv->next_seqnum; next_seqnum = priv->next_seqnum;
@ -2410,6 +2414,7 @@ again:
gap = gst_rtp_buffer_compare_seqnum (next_seqnum, seqnum); gap = gst_rtp_buffer_compare_seqnum (next_seqnum, seqnum);
if (G_LIKELY (gap == 0)) { if (G_LIKELY (gap == 0)) {
do_push:
/* no missing packet, pop and push */ /* no missing packet, pop and push */
result = pop_and_push_next (jitterbuffer, seqnum); result = pop_and_push_next (jitterbuffer, seqnum);
} else if (G_UNLIKELY (gap < 0)) { } else if (G_UNLIKELY (gap < 0)) {