rtpmpvpay: Create buffer lists instead of pushing each buffer individually

This commit is contained in:
Sebastian Dröge 2015-07-03 12:14:47 +02:00
parent f67bafb90d
commit 7e1d28d27f

View file

@ -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;
}