mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
rtpg723pay: Attach payload buffer to the output instead of copying
This commit is contained in:
parent
8aca30799a
commit
0a71dbc80c
1 changed files with 5 additions and 7 deletions
|
@ -146,27 +146,23 @@ gst_rtp_g723_pay_set_caps (GstRTPBasePayload * payload, GstCaps * caps)
|
|||
static GstFlowReturn
|
||||
gst_rtp_g723_pay_flush (GstRTPG723Pay * pay)
|
||||
{
|
||||
GstBuffer *outbuf;
|
||||
GstBuffer *outbuf, *payload_buf;
|
||||
GstFlowReturn ret;
|
||||
guint8 *payload;
|
||||
guint avail;
|
||||
GstRTPBuffer rtp = { NULL };
|
||||
|
||||
avail = gst_adapter_available (pay->adapter);
|
||||
|
||||
outbuf = gst_rtp_buffer_new_allocate (avail, 0, 0);
|
||||
outbuf = gst_rtp_buffer_new_allocate (0, 0, 0);
|
||||
|
||||
gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
|
||||
payload = gst_rtp_buffer_get_payload (&rtp);
|
||||
|
||||
GST_BUFFER_PTS (outbuf) = pay->timestamp;
|
||||
GST_BUFFER_DURATION (outbuf) = pay->duration;
|
||||
|
||||
/* copy G723 data as payload */
|
||||
gst_adapter_copy (pay->adapter, payload, 0, avail);
|
||||
payload_buf = gst_adapter_take_buffer_fast (pay->adapter, avail);
|
||||
|
||||
/* flush bytes from adapter */
|
||||
gst_adapter_flush (pay->adapter, avail);
|
||||
pay->timestamp = GST_CLOCK_TIME_NONE;
|
||||
pay->duration = 0;
|
||||
|
||||
|
@ -178,6 +174,8 @@ gst_rtp_g723_pay_flush (GstRTPG723Pay * pay)
|
|||
}
|
||||
gst_rtp_buffer_unmap (&rtp);
|
||||
|
||||
outbuf = gst_buffer_append (outbuf, payload_buf);
|
||||
|
||||
ret = gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (pay), outbuf);
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue