diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2008-05-12 18:43:41 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2008-05-12 18:43:41 +0000 |
commit | 4ab14e08490e05b913b9412d7280b73abf88e701 (patch) | |
tree | fe972ce5735eb82dfcb1508f4635aa804ba68f72 /gst/rtpmanager | |
parent | 11ebf3a6aa525480eb0ec49a2d57fab7b631ba7f (diff) | |
download | gst-plugins-bad-4ab14e08490e05b913b9412d7280b73abf88e701.tar.gz gst-plugins-bad-4ab14e08490e05b913b9412d7280b73abf88e701.tar.bz2 gst-plugins-bad-4ab14e08490e05b913b9412d7280b73abf88e701.zip |
gst/rtpmanager/gstrtpjitterbuffer.c: Avoid waiting for a negative (huge) duration when the last packet has a lower ti...
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.
Diffstat (limited to 'gst/rtpmanager')
-rw-r--r-- | gst/rtpmanager/gstrtpjitterbuffer.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c index df68e247..c62a6c50 100644 --- a/gst/rtpmanager/gstrtpjitterbuffer.c +++ b/gst/rtpmanager/gstrtpjitterbuffer.c @@ -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) { |