mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
rtpjitterbuffer: avoid mapping the buffer
Reuse the parsed structure to get the timestamps.
This commit is contained in:
parent
28f524a551
commit
0c6f4efe4a
1 changed files with 5 additions and 10 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue