[vlc-devel] commit: Revert "Another small decoder thread simplification" ( Laurent Aimar )

git version control git at videolan.org
Thu Oct 23 21:12:02 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Oct 23 21:09:50 2008 +0200| [f1670436be5d96cea0e5160fb0f020a1be4bac0c] | committer: Laurent Aimar 

Revert "Another small decoder thread simplification"

This reverts commit 3c9681e1683beb1e3c11a3e7cd9f58e9d3738751.
It breaks DMO/Qt decoding. It can be commited again when a fix
is found.

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

 src/input/decoder.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index c7e300a..8bb043b 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -297,8 +297,13 @@ void input_DecoderDelete( decoder_t *p_dec )
     }
     vlc_mutex_unlock( &p_owner->lock );
 
+    /* Make sure the thread leaves the function */
+    block_FifoWake( p_owner->p_fifo );
+
     vlc_thread_join( p_dec );
-    module_unneed( p_dec, p_dec->p_module );
+
+    /* Don't module_unneed() here because of the dll loader that wants
+     * close() in the same thread than open()/decode() */
 
     /* */
     if( p_dec->p_owner->cc.b_supported )
@@ -764,12 +769,13 @@ static void *DecoderThread( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t *)p_this;
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
 
+    int canc = vlc_savecancel();
+
     /* The decoder's main loop */
-    for (;;)
+    while( vlc_object_alive( p_dec ) )
     {
         block_t *p_block = block_FifoGet( 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. */
+
         DecoderSignalBuffering( p_dec, p_block == NULL );
 
         if( p_block )
@@ -786,6 +792,11 @@ static void *DecoderThread( vlc_object_t *p_this )
     }
 
     DecoderSignalBuffering( p_dec, true );
+
+    /* We do it here because of the dll loader that wants close() in the
+     * same thread than open()/decode() */
+    module_unneed( p_dec, p_dec->p_module );
+    vlc_restorecancel( canc );
     return NULL;
 }
 
@@ -1770,7 +1781,6 @@ static int DecoderProcess( decoder_t *p_dec, block_t *p_block )
         return VLC_SUCCESS;
     }
 
-    int canc = vlc_savecancel ();
 #ifdef ENABLE_SOUT
     if( p_dec->i_object_type == VLC_OBJECT_PACKETIZER )
     {
@@ -1822,7 +1832,6 @@ static int DecoderProcess( decoder_t *p_dec, block_t *p_block )
 
         DecoderSignalFlushed( p_dec );
     }
-    vlc_restorecancel(canc);
 
     return p_dec->b_error ? VLC_EGENERIC : VLC_SUCCESS;
 }




More information about the vlc-devel mailing list