From 0c6f4efe4ab261d4717409b631e6dac88c473622 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 19 Nov 2013 10:10:51 +0100 Subject: [PATCH] rtpjitterbuffer: avoid mapping the buffer Reuse the parsed structure to get the timestamps. --- gst/rtpmanager/rtpjitterbuffer.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/gst/rtpmanager/rtpjitterbuffer.c b/gst/rtpmanager/rtpjitterbuffer.c index 76dfa5f..639e227 100644 --- a/gst/rtpmanager/rtpjitterbuffer.c +++ b/gst/rtpmanager/rtpjitterbuffer.c @@ -916,24 +916,19 @@ guint32 rtp_jitter_buffer_get_ts_diff (RTPJitterBuffer * jbuf) { guint64 high_ts, low_ts; - GstBuffer *high_buf, *low_buf; + RTPJitterBufferItem *high_buf, *low_buf; guint32 result; - GstRTPBuffer rtp = { NULL }; g_return_val_if_fail (jbuf != NULL, 0); - high_buf = g_queue_peek_head (jbuf->packets); - low_buf = g_queue_peek_tail (jbuf->packets); + high_buf = (RTPJitterBufferItem *) g_queue_peek_head_link (jbuf->packets); + low_buf = (RTPJitterBufferItem *) g_queue_peek_tail_link (jbuf->packets); if (!high_buf || !low_buf || high_buf == low_buf) return 0; - gst_rtp_buffer_map (high_buf, GST_MAP_READ, &rtp); - high_ts = gst_rtp_buffer_get_timestamp (&rtp); - gst_rtp_buffer_unmap (&rtp); - gst_rtp_buffer_map (low_buf, GST_MAP_READ, &rtp); - low_ts = gst_rtp_buffer_get_timestamp (&rtp); - gst_rtp_buffer_unmap (&rtp); + high_ts = high_buf->rtptime; + low_ts = low_buf->rtptime; /* it needs to work if ts wraps */ if (high_ts >= low_ts) { -- 2.7.4