mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 20:05:38 +00:00
jitterbuffer: Don't leak duplicate items
When providing items with a seqnum, there is a (very small) probability that an element with the same seqnum already exists. Don't forget to free that item if it wasn't inserted. And avoid returning undefined values when dealing with duplicate items
This commit is contained in:
parent
50bb6630f5
commit
e5158ca496
2 changed files with 5 additions and 1 deletions
|
@ -3757,7 +3757,9 @@ do_lost_timeout (GstRtpJitterBuffer * jitterbuffer, TimerData * timer,
|
|||
"retry", G_TYPE_UINT, num_rtx_retry, NULL));
|
||||
}
|
||||
item = alloc_item (event, ITEM_TYPE_LOST, -1, -1, seqnum, lost_packets, -1);
|
||||
rtp_jitter_buffer_insert (priv->jbuf, item, &head, NULL);
|
||||
if (!rtp_jitter_buffer_insert (priv->jbuf, item, &head, NULL))
|
||||
/* Duplicate */
|
||||
free_item (item);
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (timer->rtx_last)) {
|
||||
/* Store info to update stats if the packet arrives too late */
|
||||
|
|
|
@ -1034,6 +1034,8 @@ append:
|
|||
duplicate:
|
||||
{
|
||||
GST_DEBUG ("duplicate packet %d found", (gint) seqnum);
|
||||
if (G_LIKELY (head))
|
||||
*head = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue