rtpjitterbuffer: update expected timer when possible
authorWim Taymans <wim.taymans@collabora.co.uk>
Fri, 20 Sep 2013 15:48:52 +0000 (17:48 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 23 Sep 2013 12:45:25 +0000 (14:45 +0200)
When we receive a packet and we have some missing packets, we can update their
estimated arrival times based on the timestamp difference.

gst/rtpmanager/gstrtpjitterbuffer.c

index d9a7b8e..8389d8c 100644 (file)
@@ -1782,9 +1782,19 @@ calculate_expected (GstRtpJitterBuffer * jitterbuffer, guint32 expected,
   expected_dts = priv->last_in_dts + duration;
 
   if (priv->do_retransmission) {
+    TimerData *timer;
+
     type = TIMER_TYPE_EXPECTED;
-    /* if we had a timer for the first missing packet, leave it. */
-    if (find_timer (jitterbuffer, type, expected)) {
+    /* if we had a timer for the first missing packet, update it. */
+    if ((timer = find_timer (jitterbuffer, type, expected))) {
+      GstClockTime timeout = timer->timeout;
+
+      timer->duration = duration;
+      if (timeout > expected_dts) {
+        GstClockTime delay = timeout - expected_dts - timer->rtx_retry;
+        reschedule_timer (jitterbuffer, timer, timer->seqnum, expected_dts,
+            delay, TRUE);
+      }
       expected++;
       expected_dts += duration;
     }