From 4a0de53cc17fa4ee9762df0f58d7a29729eb4939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 12 Apr 2016 10:15:39 +0300 Subject: [PATCH] rtpjitterbuffer: Fix rtp_jitter_buffer_get_ts_diff() fill level calculation The head of the queue is the oldest packet (as in lowest seqnum), the tail is the newest packet. To calculate the fill level, we should calculate tail-head while considering wraparounds. Not the other way around. Other code is already doing this in the correct order. https://bugzilla.gnome.org/show_bug.cgi?id=764889 --- gst/rtpmanager/rtpjitterbuffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst/rtpmanager/rtpjitterbuffer.c b/gst/rtpmanager/rtpjitterbuffer.c index 41aa8e6d06..4c359d083d 100644 --- a/gst/rtpmanager/rtpjitterbuffer.c +++ b/gst/rtpmanager/rtpjitterbuffer.c @@ -1206,8 +1206,8 @@ rtp_jitter_buffer_get_ts_diff (RTPJitterBuffer * jbuf) g_return_val_if_fail (jbuf != NULL, 0); - high_buf = (RTPJitterBufferItem *) g_queue_peek_head_link (jbuf->packets); - low_buf = (RTPJitterBufferItem *) g_queue_peek_tail_link (jbuf->packets); + high_buf = (RTPJitterBufferItem *) g_queue_peek_tail_link (jbuf->packets); + low_buf = (RTPJitterBufferItem *) g_queue_peek_head_link (jbuf->packets); if (!high_buf || !low_buf || high_buf == low_buf) return 0;