From c7c72c00b16e564ed4f0e6d80d45aeaf544d0b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 16 Jun 2014 20:15:43 +0100 Subject: [PATCH] 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. --- gst/rtp/gstrtph264pay.c | 18 ++++++------------ tests/check/elements/rtp-payloading.c | 12 ++++++++++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/gst/rtp/gstrtph264pay.c b/gst/rtp/gstrtph264pay.c index 5fb15cebe2..1ad76687a8 100644 --- a/gst/rtp/gstrtph264pay.c +++ b/gst/rtp/gstrtph264pay.c @@ -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; diff --git a/tests/check/elements/rtp-payloading.c b/tests/check/elements/rtp-payloading.c index 32d785fdaf..2ce7a5cdeb 100644 --- a/tests/check/elements/rtp-payloading.c +++ b/tests/check/elements/rtp-payloading.c @@ -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); }