summaryrefslogtreecommitdiffstats
path: root/gst/rtpmanager
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-08-31 12:47:15 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2009-08-31 12:47:15 +0200
commite254936e3417d283c72b49496c927fb5a8248e4b (patch)
treea6c23ca011b29b96c9ed6ea853474b5cc823a113 /gst/rtpmanager
parent1f14f577d873711e3f4b026f1ab709af69883684 (diff)
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
Diffstat (limited to 'gst/rtpmanager')
-rw-r--r--gst/rtpmanager/rtpjitterbuffer.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gst/rtpmanager/rtpjitterbuffer.c b/gst/rtpmanager/rtpjitterbuffer.c
index 123d26f0..18b7d07c 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)) {