From f67bafb90dbf704ef4d4f10e9278433c9386ffef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 3 Jul 2015 12:03:59 +0200 Subject: [PATCH] rtpmpapay: Use buffer lists instead of pushing each fragment individually --- gst/rtp/gstrtpmpapay.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gst/rtp/gstrtpmpapay.c b/gst/rtp/gstrtpmpapay.c index 41ed1db43e..9d9ae6f7a4 100644 --- a/gst/rtp/gstrtpmpapay.c +++ b/gst/rtp/gstrtpmpapay.c @@ -164,6 +164,8 @@ gst_rtp_mpa_pay_sink_event (GstRTPBasePayload * payload, GstEvent * event) return ret; } +#define RTP_HEADER_LEN 12 + static GstFlowReturn gst_rtp_mpa_pay_flush (GstRtpMPAPay * rtpmpapay) { @@ -171,6 +173,7 @@ gst_rtp_mpa_pay_flush (GstRtpMPAPay * rtpmpapay) GstBuffer *outbuf; GstFlowReturn ret; guint16 frag_offset; + GstBufferList *list; /* the data available in the adapter is either smaller * than the MTU or bigger. In the case it is smaller, the complete @@ -182,6 +185,10 @@ gst_rtp_mpa_pay_flush (GstRtpMPAPay * rtpmpapay) ret = GST_FLOW_OK; + list = + gst_buffer_list_new_sized (avail / (GST_RTP_BASE_PAYLOAD_MTU (rtpmpapay) - + RTP_HEADER_LEN) + 1); + frag_offset = 0; while (avail > 0) { guint towrite; @@ -235,10 +242,11 @@ gst_rtp_mpa_pay_flush (GstRtpMPAPay * rtpmpapay) GST_BUFFER_PTS (outbuf) = rtpmpapay->first_ts; GST_BUFFER_DURATION (outbuf) = rtpmpapay->duration; - - ret = gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (rtpmpapay), outbuf); + gst_buffer_list_add (list, outbuf); } + ret = gst_rtp_base_payload_push_list (GST_RTP_BASE_PAYLOAD (rtpmpapay), list); + return ret; }