]> git.sesse.net Git - vlc/commitdiff
Patch by Jilles Tjoelker: Fix ALSA thread deadlock if trying to kill it before start...
authorJean-Paul Saman <jpsaman@videolan.org>
Tue, 15 Jan 2008 19:09:18 +0000 (19:09 +0000)
committerJean-Paul Saman <jpsaman@videolan.org>
Tue, 15 Jan 2008 19:09:18 +0000 (19:09 +0000)
modules/audio_output/alsa.c

index 2ce95e52063eced728e2ba02481a98931798e242..c78566cfc4669b2c4fade4d42ff5e49e660a2602 100644 (file)
@@ -762,10 +762,13 @@ static int ALSAThread( aout_instance_t * p_aout )
 
     /* Wait for the exact time to start playing (avoids resampling) */
     vlc_mutex_lock( &p_sys->lock );
-    while( !p_sys->start_date )
+    while( !p_sys->start_date && !p_aout->b_die )
         vlc_cond_wait( &p_sys->wait, &p_sys->lock );
     vlc_mutex_unlock( &p_sys->lock );
 
+    if( p_aout->b_die )
+       goto cleanup;
+
     mwait( p_sys->start_date - AOUT_PTS_TOLERANCE / 4 );
 
     while ( !p_aout->b_die )
@@ -773,6 +776,7 @@ static int ALSAThread( aout_instance_t * p_aout )
         ALSAFill( p_aout );
     }
 
+cleanup:
     snd_pcm_drop( p_sys->p_snd_pcm );
     free( p_aout->output.p_sys->p_status );
     return 0;