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

Julian Scheel julian at jusst.de
Thu Jun 19 11:22:19 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/video_output/mmal.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/modules/video_output/mmal.c b/modules/video_output/mmal.c
index 93c32cf..d0a47e9 100644
--- a/modules/video_output/mmal.c
+++ b/modules/video_output/mmal.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
@@ -452,9 +452,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)
@@ -479,7 +476,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);
@@ -488,7 +486,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.0.0




More information about the vlc-devel mailing list