[vlc-commits] decoder: reorder thread loop

Rémi Denis-Courmont git at videolan.org
Sun Nov 1 17:06:18 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Sep 29 22:45:59 2015 +0300| [986bea5b9f4c0dc042d9765355e1e8da7196737f] | committer: Rémi Denis-Courmont

decoder: reorder thread loop

There are no real functional changes here. At the first iteration,
wait_acknowledge is no longer signaled upfront. Because the thread made
no observable changes by that point, the signal had no effects anyway.

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

 src/input/decoder.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 4d9809e..5a18deb 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1446,14 +1446,11 @@ 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 );
+    vlc_fifo_Lock( p_owner->p_fifo );
     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 );
         /* Check if thread is cancelled before processing input blocks */
         vlc_testcancel();
@@ -1490,9 +1487,12 @@ static void *DecoderThread( void *p_data )
             if( p_owner->p_aout != NULL )
                 aout_DecFlush( p_owner->p_aout, true );
         }
-        p_owner->b_drained = (p_block == NULL);
-
         vlc_restorecancel( canc );
+
+        p_owner->b_drained = (p_block == NULL);
+        vlc_fifo_Lock( p_owner->p_fifo );
+        vlc_cond_signal( &p_owner->wait_acknowledge );
+        vlc_mutex_unlock( &p_owner->lock );
     }
     vlc_assert_unreachable();
 }



More information about the vlc-commits mailing list