diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2017-05-24 16:32:30 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2017-05-24 16:41:45 +0100 |
commit | a9f916600474844c2481aebfd6122a3e33422955 (patch) | |
tree | 9885696819d4b5388d985059fcdb8712281bf20f /gst/rtp | |
parent | f9a740b319a851b6f5f170bff78538d874a97cb2 (diff) |
rtpopusdepay: minor perf improvements
Use the ::process_rtp_packet() vfunc to avoid mapping the
RTP buffer twice.
gst_rtp_buffer_get_payload_buffer() returns a new sub-buffer
which will always be writable, so no need to make it writable.
Diffstat (limited to 'gst/rtp')
-rw-r--r-- | gst/rtp/gstrtpopusdepay.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/gst/rtp/gstrtpopusdepay.c b/gst/rtp/gstrtpopusdepay.c index 293371f48..f672339f4 100644 --- a/gst/rtp/gstrtpopusdepay.c +++ b/gst/rtp/gstrtpopusdepay.c @@ -52,7 +52,7 @@ GST_STATIC_PAD_TEMPLATE ("src", ); static GstBuffer *gst_rtp_opus_depay_process (GstRTPBaseDepayload * depayload, - GstBuffer * buf); + GstRTPBuffer * rtp_buffer); static gboolean gst_rtp_opus_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps); @@ -77,7 +77,7 @@ gst_rtp_opus_depay_class_init (GstRTPOpusDepayClass * klass) "Extracts Opus audio from RTP packets", "Danilo Cesar Lemes de Paula <danilo.cesar@collabora.co.uk>"); - gstbasertpdepayload_class->process = gst_rtp_opus_depay_process; + gstbasertpdepayload_class->process_rtp_packet = gst_rtp_opus_depay_process; gstbasertpdepayload_class->set_caps = gst_rtp_opus_depay_setcaps; GST_DEBUG_CATEGORY_INIT (rtpopusdepay_debug, "rtpopusdepay", 0, @@ -140,16 +140,13 @@ gst_rtp_opus_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps) } static GstBuffer * -gst_rtp_opus_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) +gst_rtp_opus_depay_process (GstRTPBaseDepayload * depayload, + GstRTPBuffer * rtp_buffer) { GstBuffer *outbuf; - GstRTPBuffer rtpbuf = { NULL, }; - gst_rtp_buffer_map (buf, GST_MAP_READ, &rtpbuf); - outbuf = gst_rtp_buffer_get_payload_buffer (&rtpbuf); - gst_rtp_buffer_unmap (&rtpbuf); + outbuf = gst_rtp_buffer_get_payload_buffer (rtp_buffer); - outbuf = gst_buffer_make_writable (outbuf); gst_rtp_drop_non_audio_meta (depayload, outbuf); return outbuf; |