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

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


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr  1 20:56:14 2015 +0300| [00fb1b59400a27d1711d4799ffdb7dc0185a8556] | 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 times.

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

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

diff --git a/src/input/decoder.c b/src/input/decoder.c
index fc69435..4c9c274 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1417,11 +1417,13 @@ 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_mutex_unlock( &p_owner->lock );
         vlc_fifo_CleanupPush( p_owner->p_fifo );
 
         vlc_cond_signal( &p_owner->wait_fifo );
@@ -1458,10 +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