diff --git a/gst/rtpmanager/rtpjitterbuffer.c b/gst/rtpmanager/rtpjitterbuffer.c index 639e22747a..e40bece4c1 100644 --- a/gst/rtpmanager/rtpjitterbuffer.c +++ b/gst/rtpmanager/rtpjitterbuffer.c @@ -653,10 +653,13 @@ rtp_jitter_buffer_insert (RTPJitterBuffer * jbuf, RTPJitterBufferItem * item, g_return_val_if_fail (jbuf != NULL, FALSE); g_return_val_if_fail (item != NULL, FALSE); - seqnum = item->seqnum; /* no seqnum, simply append then */ - if (seqnum == -1) + if (item->seqnum == -1) { + list = jbuf->packets->head; goto append; + } + + seqnum = item->seqnum; /* loop the list to skip strictly smaller seqnum buffers */ for (list = jbuf->packets->head; list; list = g_list_next (list)) { @@ -664,10 +667,11 @@ rtp_jitter_buffer_insert (RTPJitterBuffer * jbuf, RTPJitterBufferItem * item, gint gap; RTPJitterBufferItem *qitem = (RTPJitterBufferItem *) list; - qseq = qitem->seqnum; - if (qseq == -1) + if (qitem->seqnum == -1) continue; + qseq = qitem->seqnum; + /* compare the new seqnum to the one in the buffer */ gap = gst_rtp_buffer_compare_seqnum (seqnum, qseq); @@ -681,11 +685,11 @@ rtp_jitter_buffer_insert (RTPJitterBuffer * jbuf, RTPJitterBufferItem * item, } dts = item->dts; - rtptime = item->rtptime; - - if (rtptime == -1) + if (item->rtptime == -1) goto append; + rtptime = item->rtptime; + /* rtp time jumps are checked for during skew calculation, but bypassed * in other mode, so mind those here and reset jb if needed. * Only reset if valid input time, which is likely for UDP input diff --git a/gst/rtpmanager/rtpjitterbuffer.h b/gst/rtpmanager/rtpjitterbuffer.h index 845c13664d..63eff02b04 100644 --- a/gst/rtpmanager/rtpjitterbuffer.h +++ b/gst/rtpmanager/rtpjitterbuffer.h @@ -111,10 +111,12 @@ struct _RTPJitterBufferClass { * @data: the data of the item * @next: pointer to next item * @prev: pointer to previous item - * @type: the type of @data + * @type: the type of @data, used freely by caller * @dts: input DTS * @pts: output PTS - * @seqnum: seqnum + * @seqnum: seqnum, the seqnum is used to insert the item in the + * right position in the jitterbuffer and detect duplicates. Use -1 to + * append. * @count: amount of seqnum in this item * @rtptime: rtp timestamp *