From 7e1d28d27fd2473a60117b4ce34f1489372170ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 3 Jul 2015 12:14:47 +0200 Subject: [PATCH] rtpmpvpay: Create buffer lists instead of pushing each buffer individually --- gst/rtp/gstrtpmpvpay.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gst/rtp/gstrtpmpvpay.c b/gst/rtp/gstrtpmpvpay.c index 75ae678c30..9bec0427e4 100644 --- a/gst/rtp/gstrtpmpvpay.c +++ b/gst/rtp/gstrtpmpvpay.c @@ -160,12 +160,15 @@ gst_rtp_mpv_pay_sink_event (GstRTPBasePayload * payload, GstEvent * event) return ret; } +#define RTP_HEADER_LEN 12 + static GstFlowReturn gst_rtp_mpv_pay_flush (GstRTPMPVPay * rtpmpvpay) { - GstBuffer *outbuf; GstFlowReturn ret; guint avail; + GstBufferList *list; + GstBuffer *outbuf; guint8 *payload; @@ -173,6 +176,10 @@ gst_rtp_mpv_pay_flush (GstRTPMPVPay * rtpmpvpay) ret = GST_FLOW_OK; + list = + gst_buffer_list_new_sized (avail / (GST_RTP_BASE_PAYLOAD_MTU (rtpmpvpay) - + RTP_HEADER_LEN) + 1); + while (avail > 0) { guint towrite; guint packet_len; @@ -217,10 +224,11 @@ gst_rtp_mpv_pay_flush (GstRTPMPVPay * rtpmpvpay) outbuf = gst_buffer_append (outbuf, paybuf); GST_BUFFER_PTS (outbuf) = rtpmpvpay->first_ts; - - ret = gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (rtpmpvpay), outbuf); + gst_buffer_list_add (list, outbuf); } + ret = gst_rtp_base_payload_push_list (GST_RTP_BASE_PAYLOAD (rtpmpvpay), list); + return ret; }