[vlc-devel] [PATCH] decoder: fix deadlock in input_DecoderWait

Thomas Guillem thomas at gllm.fr
Thu Dec 10 11:27:21 CET 2015


This deadlock happened when DecoderThread became idle when input was already
waiting.
---
 src/input/decoder.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 07092ee..67f8daa 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1389,6 +1389,14 @@ static void *DecoderThread( void *p_data )
             if( likely(!p_owner->b_draining) )
             {   /* Wait for a block to decode (or a request to drain) */
                 p_owner->b_idle = true;
+
+                /* idle and empty: signal input_DecoderWait to prevent a
+                 * deadlock */
+                vlc_mutex_lock( &p_owner->lock );
+                if( !p_owner->b_has_data )
+                    vlc_cond_signal( &p_owner->wait_acknowledge );
+                vlc_mutex_unlock( &p_owner->lock );
+
                 vlc_fifo_Wait( p_owner->p_fifo );
                 p_owner->b_idle = false;
                 continue;
-- 
2.1.4



More information about the vlc-devel mailing list