[vlc-devel] [PATCH 05/14] mmal/deinterlace: Clear data from buffer header before release

Julian Scheel julian at jusst.de
Wed Jun 3 09:50:30 CEST 2015


The data attached to the output port headers is not owned by the deinterlace
filter but by the vout and only temporarily attached to the codecs buffers. To
avoid refcount issues within the mmal core clear the data field before
releasing the buffers.

Signed-off-by: Julian Scheel <julian at jusst.de>
---
 modules/hw/mmal/deinterlace.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/modules/hw/mmal/deinterlace.c b/modules/hw/mmal/deinterlace.c
index 2ba63cd..c8b6484 100644
--- a/modules/hw/mmal/deinterlace.c
+++ b/modules/hw/mmal/deinterlace.c
@@ -522,8 +522,10 @@ static void input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
     filter_t *filter = (filter_t *)port->userdata;
     filter_sys_t *sys = filter->p_sys;
 
-    buffer->user_data = NULL;
     vlc_mutex_lock(&sys->buffer_cond_mutex);
+    buffer->user_data = NULL;
+    buffer->alloc_size = 0;
+    buffer->data = NULL;
     mmal_buffer_header_release(buffer);
     if (picture)
         picture_Release(picture);
@@ -547,6 +549,10 @@ static void output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
             picture = (picture_t *)buffer->user_data;
             picture_Release(picture);
             buffer->user_data = NULL;
+            buffer->alloc_size = 0;
+            buffer->data = NULL;
+            mmal_buffer_header_reset(buffer);
+            mmal_buffer_header_release(buffer);
         }
 
         atomic_fetch_sub(&sys->output_in_transit, 1);
-- 
2.4.0





More information about the vlc-devel mailing list