[gst-cvs] gst-plugins-good: jitterbuffer: make sure time never goes invalid
Wim Taymans
wtay at kemper.freedesktop.org
Mon Aug 31 03:49:16 PDT 2009
Module: gst-plugins-good
Branch: master
Commit: e254936e3417d283c72b49496c927fb5a8248e4b
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=e254936e3417d283c72b49496c927fb5a8248e4b
Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date: Mon Aug 31 12:47:15 2009 +0200
jitterbuffer: make sure time never goes invalid
Since the skew can be negative, we might end up with invalid timestamps. Check
for negative results and clamp to 0.
See #593354
---
gst/rtpmanager/rtpjitterbuffer.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/gst/rtpmanager/rtpjitterbuffer.c b/gst/rtpmanager/rtpjitterbuffer.c
index 123d26f..18b7d07 100644
--- a/gst/rtpmanager/rtpjitterbuffer.c
+++ b/gst/rtpmanager/rtpjitterbuffer.c
@@ -343,7 +343,13 @@ no_skew:
/* the output time is defined as the base timestamp plus the RTP time
* adjusted for the clock skew .*/
if (jbuf->base_time != -1) {
- out_time = jbuf->base_time + send_diff + jbuf->skew;
+ out_time = jbuf->base_time + send_diff;
+ /* skew can be negative and we don't want to make invalid timestamps */
+ if (jbuf->skew < 0 && out_time < -jbuf->skew) {
+ out_time = 0;
+ } else {
+ out_time += jbuf->skew;
+ }
/* check if timestamps are not going backwards, we can only check this if we
* have a previous out time and a previous send_diff */
if (G_LIKELY (jbuf->prev_out_time != -1 && jbuf->prev_send_diff != -1)) {
More information about the Gstreamer-commits
mailing list