[vlc-commits] mmal/codec: Improve locking

Julian Scheel git at videolan.org
Fri Jun 5 15:37:13 CEST 2015


vlc | branch: master | Julian Scheel <julian at jusst.de> | Wed Jun  3 09:37:30 2015 +0200| [47c81c46c93f729e554a9c8afba8f23976ffd65d] | committer: Jean-Baptiste Kempf

mmal/codec: Improve locking

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>
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=47c81c46c93f729e554a9c8afba8f23976ffd65d
---

 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);
 }



More information about the vlc-commits mailing list