[vlc-devel] [PATCH] decoder: fix race

Thomas Guillem thomas at gllm.fr
Tue Mar 31 09:43:42 CEST 2015


It happens when an input wait for a decoder that has not decoded any data yet.
---
 src/input/decoder.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 76c4038..6769279 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1435,11 +1435,18 @@ static void *DecoderThread( void *p_data )
                 break;
             }
 
+            vlc_mutex_lock( &p_owner->lock );
             p_owner->b_idle = true;
+            vlc_cond_signal( &p_owner->wait_acknowledge );
+            vlc_mutex_unlock( &p_owner->lock );
+
             vlc_fifo_Wait( p_owner->p_fifo );
+
             /* Make sure there is no cancellation point other than this one^^.
              * If you need one, be sure to push cleanup of p_block. */
+            vlc_mutex_lock( &p_owner->lock );
             p_owner->b_idle = false;
+            vlc_mutex_unlock( &p_owner->lock );
         }
 
         p_block = vlc_fifo_DequeueUnlocked( p_owner->p_fifo );
-- 
2.1.3




More information about the vlc-devel mailing list