]> git.sesse.net Git - vlc/commitdiff
mmal/deinterlace: Add locking to port callbacks
authorJulian Scheel <julian@jusst.de>
Mon, 19 Jan 2015 10:30:30 +0000 (11:30 +0100)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 20 Jan 2015 06:06:32 +0000 (08:06 +0200)
The in- and ouput port callbacks lead to access on the mmal pools, which are
not thread-safe. To deal with this the sys->mutex is used to lock against
usage of the mmal pools from the main thread.

Signed-off-by: Julian Scheel <julian@jusst.de>
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
modules/hw/mmal/deinterlace.c

index e6f54e18e80bc216626b8ffcd2d6db661e4efa71..edfdec875674c27be2c7e98f97aa65af8708b144 100644 (file)
@@ -479,11 +479,14 @@ static void input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
 {
     picture_t *picture = (picture_t *)buffer->user_data;
     filter_t *filter = (filter_t *)port->userdata;
+    filter_sys_t *sys = filter->p_sys;
 
     buffer->user_data = NULL;
+    vlc_mutex_lock(&sys->mutex);
     mmal_buffer_header_release(buffer);
     if (picture)
         picture_Release(picture);
+    vlc_mutex_unlock(&sys->mutex);
 }
 
 static void output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
@@ -492,6 +495,7 @@ static void output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
     filter_sys_t *sys = filter->p_sys;
     picture_t *picture;
 
+    vlc_mutex_lock(&sys->mutex);
     if (buffer->cmd == 0) {
         if (buffer->length > 0) {
             mmal_queue_put(sys->filtered_pictures, buffer);
@@ -508,4 +512,5 @@ static void output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
     } else {
         mmal_buffer_header_release(buffer);
     }
+    vlc_mutex_unlock(&sys->mutex);
 }