rtpjitterbuffer: avoid mapping the buffer

Reuse the parsed structure to get the timestamps.
This commit is contained in:
Wim Taymans 2013-11-19 10:10:51 +01:00
parent 28f524a551
commit 0c6f4efe4a

View 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) {