summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtpmp4gdepay.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-03-29 14:03:21 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-03-29 14:03:21 +0000
commitda3e23d3758e7c5b38b27c4894f1f0845e5231e9 (patch)
treefc46d7425d473f313be940b326dc11d7274d5a57 /gst/rtp/gstrtpmp4gdepay.c
parentd26cbc8c663b56976224a433c18817be5a57fe45 (diff)
gst/rtp/: Use more efficient adapter and rtpbuffer methods when possible.
Original commit message from CVS: * gst/rtp/gstrtpL16depay.c: (gst_rtp_L16_depay_process): * gst/rtp/gstrtpgsmdepay.c: (gst_rtp_gsm_depay_process): * gst/rtp/gstrtpilbcdepay.c: (gst_rtp_ilbc_depay_process): * gst/rtp/gstrtpmp2tdepay.c: (gst_rtp_mp2t_depay_process): * gst/rtp/gstrtpmp4gdepay.c: (gst_rtp_mp4g_depay_process): * gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_flush): * gst/rtp/gstrtpmp4vdepay.c: (gst_rtp_mp4v_depay_setcaps), (gst_rtp_mp4v_depay_process): * gst/rtp/gstrtpmp4vpay.c: (gst_rtp_mp4v_pay_flush): * gst/rtp/gstrtpmpadepay.c: (gst_rtp_mpa_depay_process): * gst/rtp/gstrtpmpapay.c: (gst_rtp_mpa_pay_flush): * gst/rtp/gstrtpmpvdepay.c: (gst_rtp_mpv_depay_process): * gst/rtp/gstrtppcmadepay.c: (gst_rtp_pcma_depay_process): * gst/rtp/gstrtppcmudepay.c: (gst_rtp_pcmu_depay_process): * gst/rtp/gstrtpsv3vdepay.c: (gst_rtp_sv3v_depay_process): Use more efficient adapter and rtpbuffer methods when possible.
Diffstat (limited to 'gst/rtp/gstrtpmp4gdepay.c')
-rw-r--r--gst/rtp/gstrtpmp4gdepay.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/gst/rtp/gstrtpmp4gdepay.c b/gst/rtp/gstrtpmp4gdepay.c
index 5eb87245..3483a6d6 100644
--- a/gst/rtp/gstrtpmp4gdepay.c
+++ b/gst/rtp/gstrtpmp4gdepay.c
@@ -276,7 +276,7 @@ gst_rtp_mp4g_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
goto bad_packet;
{
- gint payload_len;
+ gint payload_len, payload_header;
guint8 *payload;
guint32 timestamp;
guint AU_headers_len;
@@ -284,6 +284,7 @@ gst_rtp_mp4g_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
payload_len = gst_rtp_buffer_get_payload_len (buf);
payload = gst_rtp_buffer_get_payload (buf);
+ payload_header = 0;
if (rtpmp4gdepay->sizelength > 0) {
/* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- .. -+-+-+-+-+-+-+-+-+-+
@@ -298,6 +299,7 @@ gst_rtp_mp4g_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
/* skip header */
payload += 2;
+ payload_header += 2;
payload_len -= 2;
/* FIXME, use bits */
@@ -309,14 +311,15 @@ gst_rtp_mp4g_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
/* skip special headers */
payload += (AU_headers_len + 7) / 8;
+ payload_header += (AU_headers_len + 7) / 8;
payload_len = AU_size;
}
timestamp = gst_rtp_buffer_get_timestamp (buf);
- outbuf = gst_buffer_new_and_alloc (payload_len);
- memcpy (GST_BUFFER_DATA (outbuf), payload, payload_len);
-
+ /* strip header from payload and push in the adapter */
+ outbuf =
+ gst_rtp_buffer_get_payload_subbuffer (buf, payload_header, payload_len);
gst_adapter_push (rtpmp4gdepay->adapter, outbuf);
/* if this was the last packet of the VOP, create and push a buffer */
@@ -325,11 +328,7 @@ gst_rtp_mp4g_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
avail = gst_adapter_available (rtpmp4gdepay->adapter);
- outbuf = gst_buffer_new ();
- GST_BUFFER_SIZE (outbuf) = avail;
- GST_BUFFER_MALLOCDATA (outbuf) =
- gst_adapter_take (rtpmp4gdepay->adapter, avail);
- GST_BUFFER_DATA (outbuf) = GST_BUFFER_MALLOCDATA (outbuf);
+ outbuf = gst_adapter_take_buffer (rtpmp4gdepay->adapter, avail);
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (depayload->srcpad));
GST_BUFFER_TIMESTAMP (outbuf) = gst_util_uint64_scale_int
(timestamp, GST_SECOND, depayload->clock_rate);