rtpjitterbuffer: No need to wake the timer thread on head changes
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Thu, 20 Jun 2019 19:59:48 +0000 (15:59 -0400)
committerOlivier CrĂȘte <olivier.crete@collabora.com>
Fri, 27 Sep 2019 21:34:04 +0000 (17:34 -0400)
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
tests/check/elements/rtpjitterbuffer.c

index 1ed9118..12bdedb 100644 (file)
@@ -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,
index 6e07b4d..1ce01ce 100644 (file)
@@ -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);