[vlc-commits] decoder: work around unlikely deadlock in input_DecoderWait()

Rémi Denis-Courmont git at videolan.org
Wed Apr 1 20:03:58 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr  1 20:56:14 2015 +0300| [6b1892fa04f0d5b66e37ad43e64a711b572e0780] | committer: Rémi Denis-Courmont

decoder: work around unlikely deadlock in input_DecoderWait()

ES output should probably not wait when there is no data... but it
does it at timest.

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

 src/input/decoder.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index fc69435..79a83c1 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1417,11 +1417,14 @@ static void *DecoderThread( void *p_data )
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
 
     /* The decoder's main loop */
+    vlc_mutex_lock( &p_owner->lock );
     for( ;; )
     {
         block_t *p_block;
 
         vlc_fifo_Lock( p_owner->p_fifo );
+        vlc_cond_signal( &p_owner->wait_acknowledge );
+        vlc_mutex_unlock( &p_owner->lock );
         vlc_fifo_CleanupPush( p_owner->p_fifo );
 
         vlc_cond_signal( &p_owner->wait_fifo );
@@ -1457,11 +1460,9 @@ static void *DecoderThread( void *p_data )
         }
         p_owner->b_drained = (p_block == NULL);
 
-        vlc_cond_signal( &p_owner->wait_acknowledge );
-        vlc_mutex_unlock( &p_owner->lock );
         vlc_restorecancel( canc );
     }
-    return NULL;
+    vlc_assert_unreachable();
 }
 
 /**



More information about the vlc-commits mailing list