[vlc-devel] [PATCH 4/6] mmal/vout: Rework buffer handling

Julian Scheel julian at jusst.de
Fri Aug 29 09:09:36 CEST 2014


This patch reflects the buffer handling improvements done in the mmal codec
module into the the mmal video output module.
A nice side effect of the restructuring is that less magic values need to be
defined as the required values can be computed dynamically now.

Signed-off-by: Julian Scheel <julian at jusst.de>
---
 modules/hw/mmal/vout.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index b8ca3e1..667edf0 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -43,7 +43,7 @@
 /* This value must match the define in codec/mmal.c
  * Think twice before changing this. Incorrect values cause havoc.
  */
-#define NUM_ACTUAL_OPAQUE_BUFFERS 40
+#define NUM_ACTUAL_OPAQUE_BUFFERS 22
 
 #define MAX_BUFFERS_IN_TRANSIT 2
 #define VC_TV_MAX_MODE_IDS 127
@@ -433,9 +433,6 @@ static picture_pool_t *vd_pool(vout_display_t *vd, unsigned count)
     if (sys->opaque) {
         if (count <= NUM_ACTUAL_OPAQUE_BUFFERS)
             count = NUM_ACTUAL_OPAQUE_BUFFERS;
-        else
-            msg_Err(vd, "More picture (%u) than NUM_ACTUAL_OPAQUE_BUFFERS (%d) requested. Expect errors",
-                            count, NUM_ACTUAL_OPAQUE_BUFFERS);
     }
 
     if (count < sys->input->buffer_num_recommended)
@@ -460,7 +457,8 @@ static picture_pool_t *vd_pool(vout_display_t *vd, unsigned count)
         goto out;
     }
 
-    sys->pool = mmal_pool_create_with_allocator(count, sys->input->buffer_size,
+    sys->num_buffers = count;
+    sys->pool = mmal_pool_create_with_allocator(sys->num_buffers, sys->input->buffer_size,
                     sys->input,
                     (mmal_pool_allocator_alloc_t)mmal_port_payload_alloc,
                     (mmal_pool_allocator_free_t)mmal_port_payload_free);
@@ -469,7 +467,6 @@ static picture_pool_t *vd_pool(vout_display_t *vd, unsigned count)
                         count, sys->input->buffer_size);
         goto out;
     }
-    sys->num_buffers = count;
 
     memset(&picture_res, 0, sizeof(picture_resource_t));
     sys->pictures = calloc(sys->num_buffers, sizeof(picture_t *));
-- 
2.1.0




More information about the vlc-devel mailing list