mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-17 22:06:41 +00:00
rtpbaseaudiopayload: Avoid copying the data
This commit is contained in:
parent
953a3479ff
commit
c6fd304eb6
1 changed files with 4 additions and 9 deletions
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue