rtpjitterbuffer: avoid mapping the buffer
authorWim Taymans <wim.taymans@gmail.com>
Tue, 19 Nov 2013 09:10:51 +0000 (10:10 +0100)
committerWim Taymans <wim.taymans@gmail.com>
Tue, 19 Nov 2013 09:12:00 +0000 (10:12 +0100)
Reuse the parsed structure to get the timestamps.

gst/rtpmanager/rtpjitterbuffer.c

index 76dfa5f..639e227 100644 (file)
@@ -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) {