Commit e5158ca4 authored by Edward Hervey's avatar Edward Hervey 🤘
Browse files

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
parent 50bb6630
......@@ -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:
GST_DEBUG ("duplicate packet %d found", (gint) seqnum);
if (G_LIKELY (head))
*head = FALSE;
return FALSE;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment