gst/rtpmanager/gstrtpjitterbuffer.c: Avoid waiting for a negative (huge) duration...
authorWim Taymans <wim.taymans@gmail.com>
Mon, 12 May 2008 18:43:41 +0000 (18:43 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Mon, 12 May 2008 18:43:41 +0000 (18:43 +0000)
Original commit message from CVS:
* gst/rtpmanager/gstrtpjitterbuffer.c:
(gst_rtp_jitter_buffer_loop):
Avoid waiting for a negative (huge) duration when the last packet has a
lower timestamp than the current packet.

ChangeLog
gst/rtpmanager/gstrtpjitterbuffer.c

index 724a1f9..66d4c9d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-05-12  Wim Taymans  <wim.taymans@collabora.co.uk>
+
+       * gst/rtpmanager/gstrtpjitterbuffer.c:
+       (gst_rtp_jitter_buffer_loop):
+       Avoid waiting for a negative (huge) duration when the last packet has a
+       lower timestamp than the current packet.
+
 2008-05-12  Peter Kjellerstedt  <pkj@axis.com>
 
        * gst/rtpmanager/gstrtpsession.c: (gst_rtp_session_query_send_rtcp_src):
index df68e24..c62a6c5 100644 (file)
@@ -1117,8 +1117,13 @@ again:
             GST_TIME_ARGS (out_time), GST_TIME_ARGS (priv->last_out_time));
         /* interpollate between the current time and the last time based on
          * number of packets we are missing, this is the estimated duration
-         * for the missing packet based on equidistant packet spacing. */
-        duration = (out_time - priv->last_out_time) / (gap + 1);
+         * for the missing packet based on equidistant packet spacing. Also make
+         * sure we never go negative. */
+        if (out_time > priv->last_out_time)
+          duration = (out_time - priv->last_out_time) / (gap + 1);
+        else
+          goto lost;
+
         GST_DEBUG_OBJECT (jitterbuffer, "duration %" GST_TIME_FORMAT,
             GST_TIME_ARGS (duration));
         /* add this duration to the timestamp of the last packet we pushed */
@@ -1176,6 +1181,7 @@ again:
       goto again;
     }
 
+  lost:
     /* we now timed out, this means we lost a packet or finished synchronizing
      * on the first buffer. */
     if (gap > 0) {