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)) {
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);
}
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
* @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
*