[vlc-devel] [PATCH 3/8] mmal/codec: Improve locking

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


Only lock when really needed. To do this feeding the mmal port with buffers is
done from one place only now.

Signed-off-by: Julian Scheel <julian at jusst.de>
---
 modules/hw/mmal/codec.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/modules/hw/mmal/codec.c b/modules/hw/mmal/codec.c
index 0466c3a..183981c 100644
--- a/modules/hw/mmal/codec.c
+++ b/modules/hw/mmal/codec.c
@@ -527,7 +527,6 @@ static picture_t *decode(decoder_t *dec, block_t **pblock)
      * Send output buffers
      */
     if (sys->output_pool) {
-        vlc_mutex_lock(&sys->mutex);
         buffer = mmal_queue_get(sys->decoded_pictures);
         if (buffer) {
             ret = (picture_t *)buffer->user_data;
@@ -540,7 +539,6 @@ static picture_t *decode(decoder_t *dec, block_t **pblock)
         }
 
         fill_output_port(dec);
-        vlc_mutex_unlock(&sys->mutex);
     }
 
     if (ret)
@@ -647,11 +645,9 @@ static void output_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer)
     MMAL_EVENT_FORMAT_CHANGED_T *fmt;
     MMAL_ES_FORMAT_T *format;
 
-    vlc_mutex_lock(&sys->mutex);
     if (buffer->cmd == 0) {
         if (buffer->length > 0) {
             mmal_queue_put(sys->decoded_pictures, buffer);
-            fill_output_port(dec);
         } else {
             picture = (picture_t *)buffer->user_data;
             picture_Release(picture);
@@ -676,5 +672,4 @@ 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);
 }
-- 
2.4.0





More information about the vlc-devel mailing list