mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
jitterbuffer: correctly check for invalid values
Check for -1 on the guint from the buffer item instead of on the guint16 or guint32. Also insert -1 seqnum at the head of the jitterbuffer.
This commit is contained in:
parent
fdf8ac40d8
commit
ea2a222cef
2 changed files with 15 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue