mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
rtph264pay: push single buffer directly, no need to wrap it in a bufferlist
No point in a buffer list if we just have one single buffer to push. Fix up unit test to handle that case as well.
This commit is contained in:
parent
0f5da64de3
commit
c7c72c00b1
2 changed files with 18 additions and 12 deletions
|
@ -824,12 +824,11 @@ gst_rtp_h264_pay_payload_nal (GstRTPBasePayload * basepayload,
|
|||
packet_len = gst_rtp_buffer_calc_packet_len (size, 0, 0);
|
||||
|
||||
if (packet_len < mtu) {
|
||||
/* will fit in one packet */
|
||||
GST_DEBUG_OBJECT (basepayload,
|
||||
"NAL Unit fit in one packet datasize=%d mtu=%d", size, mtu);
|
||||
/* will fit in one packet */
|
||||
|
||||
/* use buffer lists
|
||||
* create buffer without payload containing only the RTP header
|
||||
/* create buffer without payload containing only the RTP header
|
||||
* (memory block at index 0) */
|
||||
outbuf = gst_rtp_buffer_new_allocate (0, 0, 0);
|
||||
|
||||
|
@ -844,18 +843,13 @@ gst_rtp_h264_pay_payload_nal (GstRTPBasePayload * basepayload,
|
|||
GST_BUFFER_PTS (outbuf) = pts;
|
||||
GST_BUFFER_DTS (outbuf) = dts;
|
||||
|
||||
gst_rtp_buffer_unmap (&rtp);
|
||||
|
||||
/* insert payload memory block */
|
||||
outbuf = gst_buffer_append (outbuf, paybuf);
|
||||
|
||||
list = gst_buffer_list_new ();
|
||||
|
||||
/* add the buffer to the buffer list */
|
||||
gst_buffer_list_add (list, outbuf);
|
||||
|
||||
gst_rtp_buffer_unmap (&rtp);
|
||||
|
||||
/* push the list to the next element in the pipe */
|
||||
ret = gst_rtp_base_payload_push_list (basepayload, list);
|
||||
/* push the buffer to the next element */
|
||||
ret = gst_rtp_base_payload_push (basepayload, outbuf);
|
||||
} else {
|
||||
/* fragmentation Units FU-A */
|
||||
guint limitedSize;
|
||||
|
|
|
@ -79,6 +79,16 @@ rtp_pipeline_chain_list (GstPad * pad, GstObject * parent, GstBufferList * list)
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
rtp_pipeline_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
||||
{
|
||||
GstBufferList *list;
|
||||
|
||||
list = gst_buffer_list_new_sized (1);
|
||||
gst_buffer_list_add (list, buf);
|
||||
return rtp_pipeline_chain_list (pad, parent, list);
|
||||
}
|
||||
|
||||
/*
|
||||
* RTP bus callback.
|
||||
*/
|
||||
|
@ -303,6 +313,8 @@ rtp_pipeline_enable_lists (rtp_pipeline * p, guint mtu_size)
|
|||
pad = gst_element_get_static_pad (p->rtpdepay, "sink");
|
||||
gst_pad_set_chain_list_function (pad,
|
||||
GST_DEBUG_FUNCPTR (rtp_pipeline_chain_list));
|
||||
/* .. to satisfy this silly test code in case someone dares push a buffer */
|
||||
gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (rtp_pipeline_chain));
|
||||
gst_object_unref (pad);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue