rtph264pay: pre-allocate bufferlist of the right size
authorTim-Philipp Müller <tim@centricular.com>
Wed, 18 Jun 2014 06:52:05 +0000 (07:52 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 18 Jun 2014 13:54:58 +0000 (14:54 +0100)
To avoid unnecessary re-allocs.

gst/rtp/gstrtph264pay.c

index 1ad7668..7c6c821 100644 (file)
@@ -869,7 +869,7 @@ gst_rtp_h264_pay_payload_nal (GstRTPBasePayload * basepayload,
     /* We keep 2 bytes for FU indicator and FU Header */
     payload_len = gst_rtp_buffer_calc_payload_len (mtu - 2, 0, 0);
 
-    list = gst_buffer_list_new ();
+    list = gst_buffer_list_new_sized ((size / payload_len) + 1);
 
     while (end == 0) {
       limitedSize = size < payload_len ? size : payload_len;