From 8aca30799a6dd4b2d3acc44723af9e95f15f6619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 1 Jul 2015 17:30:39 +0200 Subject: [PATCH] rtpdvdepay: Map the output buffer once instead of once every 80 bytes --- gst/rtp/gstrtpdvdepay.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gst/rtp/gstrtpdvdepay.c b/gst/rtp/gstrtpdvdepay.c index f13b696f47..fd738c48f7 100644 --- a/gst/rtp/gstrtpdvdepay.c +++ b/gst/rtp/gstrtpdvdepay.c @@ -295,6 +295,7 @@ gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstBuffer * in) GstRTPDVDepay *dvdepay = GST_RTP_DV_DEPAY (base); gboolean marker; GstRTPBuffer rtp = { NULL, }; + GstMapInfo map; gst_rtp_buffer_map (in, GST_MAP_READ, &rtp); @@ -320,6 +321,7 @@ gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstBuffer * in) payload = gst_rtp_buffer_get_payload (&rtp); /* copy all DIF chunks in their place. */ + gst_buffer_map (dvdepay->acc, &map, GST_MAP_READWRITE); while (payload_len >= 80) { guint offset; @@ -340,14 +342,16 @@ gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstBuffer * in) offset = location * 80; /* And copy it in, provided the location is sane. */ - if (offset <= dvdepay->frame_size - 80) - gst_buffer_fill (dvdepay->acc, offset, payload, 80); + if (offset <= dvdepay->frame_size - 80) { + memcpy (map.data + offset, payload, 80); + } } payload += 80; payload_len -= 80; } gst_rtp_buffer_unmap (&rtp); + gst_buffer_unmap (dvdepay->acc, &map); if (marker) { GST_DEBUG_OBJECT (dvdepay, "marker bit complete frame %u", rtp_ts);