decoder: fix data race
authorThomas Guillem <thomas@gllm.fr>
Thu, 12 Jul 2018 16:27:55 +0000 (18:27 +0200)
committerThomas Guillem <thomas@gllm.fr>
Thu, 12 Jul 2018 16:48:18 +0000 (18:48 +0200)
p_owner->b_draining need to be protected by the fifo lock.

src/input/decoder.c

index 2c332a9..62717af 100644 (file)
@@ -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 );
     }