[vlc-commits] decoder: fix data race

Thomas Guillem git at videolan.org
Thu Jul 12 18:49:29 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jul 12 18:27:55 2018 +0200| [1e82322d41bb1439a127db5842abd6bf50675ae8] | committer: Thomas Guillem

decoder: fix data race

p_owner->b_draining need to be protected by the fifo lock.

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

 src/input/decoder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 2c332a9d53..62717af48a 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1635,12 +1635,12 @@ static void *DecoderThread( void *p_data )
 
         /* TODO? Wait for draining instead of polling. */
         vlc_mutex_lock( &p_owner->lock );
+        vlc_fifo_Lock( p_owner->p_fifo );
         if( p_owner->b_draining && (p_block == NULL) )
         {
             p_owner->b_draining = false;
             p_owner->drained = true;
         }
-        vlc_fifo_Lock( p_owner->p_fifo );
         vlc_cond_signal( &p_owner->wait_acknowledge );
         vlc_mutex_unlock( &p_owner->lock );
     }



More information about the vlc-commits mailing list