[vlc-commits] mmal/codec: Optimise buffer allocation

Julian Scheel git at videolan.org
Thu Oct 19 11:38:45 CEST 2017


vlc | branch: master | Julian Scheel <julian at jusst.de> | Thu Oct 19 11:23:05 2017 +0200| [f9d9d929cfba8ba4a38ceba93677a63f28ef9c2d] | committer: Jean-Baptiste Kempf

mmal/codec: Optimise buffer allocation

Reduce the number of extra buffers, which effectively controls the size
of the allocated picture pool inside the codec.
At the same time increase the input buffer count, so that it is big
enough to contain all possibly sent pictures from the vout.

Signed-off-by: Julian Scheel <julian at jusst.de>
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f9d9d929cfba8ba4a38ceba93677a63f28ef9c2d
---

 modules/hw/mmal/codec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/hw/mmal/codec.c b/modules/hw/mmal/codec.c
index f8ffbdfeef..625e6ce583 100644
--- a/modules/hw/mmal/codec.c
+++ b/modules/hw/mmal/codec.c
@@ -42,8 +42,8 @@
 /*
  * This seems to be a bit high, but reducing it causes instabilities
  */
-#define NUM_EXTRA_BUFFERS 20
-#define NUM_DECODER_BUFFER_HEADERS 20
+#define NUM_EXTRA_BUFFERS 5
+#define NUM_DECODER_BUFFER_HEADERS 30
 
 #define MIN_NUM_BUFFERS_IN_TRANSIT 2
 
@@ -338,7 +338,7 @@ port_reset:
     }
 
     if (sys->opaque) {
-        sys->output->buffer_num = NUM_ACTUAL_OPAQUE_BUFFERS;
+        sys->output->buffer_num = NUM_DECODER_BUFFER_HEADERS;
         pool_size = NUM_DECODER_BUFFER_HEADERS;
     } else {
         sys->output->buffer_num = __MAX(sys->output->buffer_num_recommended,
@@ -508,7 +508,7 @@ static void fill_output_port(decoder_t *dec)
                 MIN_NUM_BUFFERS_IN_TRANSIT);
         buffers_available = mmal_queue_length(sys->output_pool->queue);
     } else {
-        max_buffers_in_transit = __MAX(sys->output->buffer_num, MIN_NUM_BUFFERS_IN_TRANSIT);
+        max_buffers_in_transit = NUM_DECODER_BUFFER_HEADERS;
         buffers_available = NUM_DECODER_BUFFER_HEADERS - atomic_load(&sys->output_in_transit) -
             mmal_queue_length(sys->decoded_pictures);
     }



More information about the vlc-commits mailing list