rtpbaseaudiopayload: Avoid copying the data

This commit is contained in:
Olivier Crête 2013-07-15 16:13:11 -04:00
parent 953a3479ff
commit c6fd304eb6

View file

@ -564,7 +564,6 @@ gst_rtp_base_audio_payload_flush (GstRTPBaseAudioPayload * baseaudiopayload,
GstRTPBasePayload *basepayload; GstRTPBasePayload *basepayload;
GstRTPBaseAudioPayloadPrivate *priv; GstRTPBaseAudioPayloadPrivate *priv;
GstBuffer *outbuf; GstBuffer *outbuf;
guint8 *payload;
GstFlowReturn ret; GstFlowReturn ret;
GstAdapter *adapter; GstAdapter *adapter;
guint64 distance; guint64 distance;
@ -609,17 +608,13 @@ gst_rtp_base_audio_payload_flush (GstRTPBaseAudioPayload * baseaudiopayload,
gst_rtp_base_audio_payload_push_buffer (baseaudiopayload, buffer, gst_rtp_base_audio_payload_push_buffer (baseaudiopayload, buffer,
timestamp); timestamp);
} else { } else {
GstRTPBuffer rtp = { NULL }; GstBuffer *paybuf;
/* create buffer to hold the payload */ /* create buffer to hold the payload */
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0); outbuf = gst_rtp_buffer_new_allocate (0, 0, 0);
/* copy payload */ paybuf = gst_adapter_take_buffer_fast (adapter, payload_len);
gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp); outbuf = gst_buffer_append (outbuf, paybuf);
payload = gst_rtp_buffer_get_payload (&rtp);
gst_adapter_copy (adapter, payload, 0, payload_len);
gst_adapter_flush (adapter, payload_len);
gst_rtp_buffer_unmap (&rtp);
/* set metadata */ /* set metadata */
gst_rtp_base_audio_payload_set_meta (baseaudiopayload, outbuf, payload_len, gst_rtp_base_audio_payload_set_meta (baseaudiopayload, outbuf, payload_len,