rtpjitterbuffer: Don't use stats timer on the timers queue

The timer passed to update_timers may be from the stats timer. At the
moment, we could endup rescheduling (reusing) that timer onto the normal
timer queue, unschedul it as if it was from the normal timer queue or
duplicate it into the stats timer queue again. This was protected before
as the with the fact the stats timer didn't have a valid idx.
This commit is contained in:
Nicolas Dufresne 2019-07-02 15:52:25 -04:00 committed by Olivier Crête
parent 81bffb5e5c
commit 9ebcadb349

View file

@ -2139,6 +2139,10 @@ update_timers (GstRtpJitterBuffer * jitterbuffer, guint16 seqnum,
gboolean is_rtx, RtpTimer * timer)
{
GstRtpJitterBufferPrivate *priv = jitterbuffer->priv;
gboolean is_stats_timer = FALSE;
if (timer && rtp_timer_queue_find (priv->rtx_stats_timers, timer->seqnum))
is_stats_timer = TRUE;
/* schedule immediatly expected timer which exceed the maximum RTX delay
* reorder configuration */
@ -2187,7 +2191,7 @@ update_timers (GstRtpJitterBuffer * jitterbuffer, guint16 seqnum,
do_next_seqnum = FALSE;
}
if (!is_rtx || timer->num_rtx_retry > 1) {
if (!is_stats_timer && (!is_rtx || timer->num_rtx_retry > 1)) {
RtpTimer *stats_timer = rtp_timer_dup (timer);
/* Store timer in order to record stats when/if the retransmitted
* packet arrives. We should also store timer information if we've
@ -2216,7 +2220,7 @@ update_timers (GstRtpJitterBuffer * jitterbuffer, guint16 seqnum,
GST_TIME_ARGS (expected), GST_TIME_ARGS (delay),
GST_TIME_ARGS (priv->packet_spacing), GST_TIME_ARGS (priv->avg_jitter));
if (timer) {
if (timer && !is_stats_timer) {
timer->type = RTP_TIMER_EXPECTED;
rtp_timer_queue_update_timer (priv->timers, timer, priv->next_in_seqnum,
expected, delay, 0, TRUE);
@ -2224,7 +2228,7 @@ update_timers (GstRtpJitterBuffer * jitterbuffer, guint16 seqnum,
rtp_timer_queue_set_expected (priv->timers, priv->next_in_seqnum,
expected, delay, priv->packet_spacing);
}
} else if (timer && timer->type != RTP_TIMER_DEADLINE) {
} else if (timer && timer->type != RTP_TIMER_DEADLINE && !is_stats_timer) {
/* if we had a timer, remove it, we don't know when to expect the next
* packet. */
rtp_timer_queue_unschedule (priv->timers, timer);