mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 06:16:36 +00:00
sbcpay: Attach payload directly to the output instead of copying
This commit is contained in:
parent
ef8d630a59
commit
6675e33109
1 changed files with 4 additions and 7 deletions
|
@ -160,7 +160,7 @@ gst_rtp_sbc_pay_flush_buffers (GstRtpSBCPay * sbcpay)
|
||||||
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
|
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
|
||||||
guint available;
|
guint available;
|
||||||
guint max_payload;
|
guint max_payload;
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf, *paybuf;
|
||||||
guint8 *payload_data;
|
guint8 *payload_data;
|
||||||
guint frame_count;
|
guint frame_count;
|
||||||
guint payload_length;
|
guint payload_length;
|
||||||
|
@ -183,8 +183,7 @@ gst_rtp_sbc_pay_flush_buffers (GstRtpSBCPay * sbcpay)
|
||||||
if (payload_length == 0) /* Nothing to send */
|
if (payload_length == 0) /* Nothing to send */
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
outbuf = gst_rtp_buffer_new_allocate (payload_length +
|
outbuf = gst_rtp_buffer_new_allocate (RTP_SBC_PAYLOAD_HEADER_SIZE, 0, 0);
|
||||||
RTP_SBC_PAYLOAD_HEADER_SIZE, 0, 0);
|
|
||||||
|
|
||||||
/* get payload */
|
/* get payload */
|
||||||
gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
|
gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
|
||||||
|
@ -197,12 +196,10 @@ gst_rtp_sbc_pay_flush_buffers (GstRtpSBCPay * sbcpay)
|
||||||
memset (payload, 0, sizeof (struct rtp_payload));
|
memset (payload, 0, sizeof (struct rtp_payload));
|
||||||
payload->frame_count = frame_count;
|
payload->frame_count = frame_count;
|
||||||
|
|
||||||
gst_adapter_copy (sbcpay->adapter, payload_data +
|
|
||||||
RTP_SBC_PAYLOAD_HEADER_SIZE, 0, payload_length);
|
|
||||||
|
|
||||||
gst_rtp_buffer_unmap (&rtp);
|
gst_rtp_buffer_unmap (&rtp);
|
||||||
|
|
||||||
gst_adapter_flush (sbcpay->adapter, payload_length);
|
paybuf = gst_adapter_take_buffer_fast (sbcpay->adapter, payload_length);
|
||||||
|
outbuf = gst_buffer_append (outbuf, paybuf);
|
||||||
|
|
||||||
/* FIXME: what about duration? */
|
/* FIXME: what about duration? */
|
||||||
GST_BUFFER_PTS (outbuf) = sbcpay->timestamp;
|
GST_BUFFER_PTS (outbuf) = sbcpay->timestamp;
|
||||||
|
|
Loading…
Reference in a new issue