[vlc-devel] [PATCH 1/2] dec: lock aout/vout when read from DecoderThread

Thomas Guillem thomas at gllm.fr
Mon Jul 2 14:52:58 CEST 2018


---
v2: lock the aout/vout while excecuting the command.
v1 can be found here: https://patches.videolan.org/patch/20647/

 src/input/decoder.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 988103ea78..79fb4fcc87 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1491,6 +1491,8 @@ static void OutputChangePause( decoder_t *p_dec, bool paused, vlc_tick_t date )
     struct decoder_owner *p_owner = dec_get_owner( p_dec );
 
     msg_Dbg( p_dec, "toggling %s", paused ? "resume" : "pause" );
+
+    vlc_mutex_lock( &p_owner->lock );
     switch( p_dec->fmt_out.i_cat )
     {
         case VIDEO_ES:
@@ -1506,6 +1508,7 @@ static void OutputChangePause( decoder_t *p_dec, bool paused, vlc_tick_t date )
         default:
             vlc_assert_unreachable();
     }
+    vlc_mutex_unlock( &p_owner->lock );
 }
 
 static void OutputChangeRate( decoder_t *p_dec, float rate )
@@ -1513,6 +1516,8 @@ static void OutputChangeRate( decoder_t *p_dec, float rate )
     struct decoder_owner *p_owner = dec_get_owner( p_dec );
 
     msg_Dbg( p_dec, "changing rate: %f", rate );
+
+    vlc_mutex_lock( &p_owner->lock );
     switch( p_dec->fmt_out.i_cat )
     {
         case VIDEO_ES:
@@ -1526,6 +1531,7 @@ static void OutputChangeRate( decoder_t *p_dec, float rate )
         default:
             vlc_assert_unreachable();
     }
+    vlc_mutex_unlock( &p_owner->lock );
 }
 
 /**
-- 
2.18.0



More information about the vlc-devel mailing list