rtpjitterbuffer: Check the exit condition after executing timers

The do_expected_timeout() function may release the JBUF_LOCK, so we need
to check if nothing wanted the timer thread to exit after this call.
The side effect was that we may endup going back into waiting for a timer
which will cause arbitrary delay on tear down (or deadlock when test
clock is used).

Fixes #653
This commit is contained in:
Nicolas Dufresne 2019-11-14 17:33:08 -05:00
parent fd6cd6f545
commit db187eec19

View file

@ -4044,9 +4044,14 @@ wait_next_timeout (GstRtpJitterBuffer * jitterbuffer)
}
} while ((timer = rtp_timer_queue_pop_until (priv->timers, now)));
/* execetute the remaining timers */
/* execute the remaining timers */
while ((timer = (RtpTimer *) g_queue_pop_head_link (&timers)))
do_timeout (jitterbuffer, timer, now);
/* do_expected_timeout(), called by do_timeout will drop the
* JBUF_LOCK, so we need to check if we are still running */
if (!priv->timer_running)
goto stopping;
}
timer = rtp_timer_queue_peek_earliest (priv->timers);