From d4c6c335c5b3b6037cc79ecf770043845bf653e5 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 20 Jun 2019 15:59:48 -0400 Subject: [PATCH] rtpjitterbuffer: No need to wake the timer thread on head changes If the jitterbuffer head change, there is no need to systematically wakeup the timer thread. The timer thread will be waken up on if an earlier timeout has been pushed. This prevent some more spurious wakeup when the system is loaded. As a side effect, cranking the clock may set the clock at an earlier position. --- gst/rtpmanager/gstrtpjitterbuffer.c | 7 ------- tests/check/elements/rtpjitterbuffer.c | 9 +++++++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c index 1ed91182bb..12bdedba7a 100644 --- a/gst/rtpmanager/gstrtpjitterbuffer.c +++ b/gst/rtpmanager/gstrtpjitterbuffer.c @@ -3009,13 +3009,6 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent, /* signal addition of new buffer when the _loop is waiting. */ if (G_LIKELY (priv->active)) JBUF_SIGNAL_EVENT (priv); - - /* let's unschedule and unblock any waiting buffers. We only want to do this - * when the head buffer changed */ - if (G_UNLIKELY (priv->clock_id)) { - GST_DEBUG_OBJECT (jitterbuffer, "Unscheduling waiting new buffer"); - unschedule_current_timer (jitterbuffer); - } } GST_DEBUG_OBJECT (jitterbuffer, diff --git a/tests/check/elements/rtpjitterbuffer.c b/tests/check/elements/rtpjitterbuffer.c index 6e07b4d4f8..1ce01ce3dc 100644 --- a/tests/check/elements/rtpjitterbuffer.c +++ b/tests/check/elements/rtpjitterbuffer.c @@ -2047,8 +2047,13 @@ GST_START_TEST (test_rtx_with_backwards_rtptime) gst_buffer_unref (gst_harness_pull (h)); /* crank to time-out the rtx-request for seqnum 6, the point here - being that the backwards rtptime did not mess up the timeout for - the rtx event */ + * being that the backwards rtptime did not mess up the timeout for + * the rtx event. + * + * Note: the jitterbuffer no longer update early timers, as a result + * we need to advance the clock to the expected point + */ + gst_harness_set_time (h, 6 * TEST_BUF_DURATION + 15 * GST_MSECOND); gst_harness_crank_single_clock_wait (h); verify_rtx_event (h, 6, 5 * TEST_BUF_DURATION + 15 * GST_MSECOND, 17, 35 * GST_MSECOND);