Commit 76d02025 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Patch by Jilles Tjoelker: Fix ALSA thread deadlock if trying to kill it before start time is known.

parent 765078f3
...@@ -762,10 +762,13 @@ static int ALSAThread( aout_instance_t * p_aout ) ...@@ -762,10 +762,13 @@ static int ALSAThread( aout_instance_t * p_aout )
/* Wait for the exact time to start playing (avoids resampling) */ /* Wait for the exact time to start playing (avoids resampling) */
vlc_mutex_lock( &p_sys->lock ); 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_cond_wait( &p_sys->wait, &p_sys->lock );
vlc_mutex_unlock( &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 ); mwait( p_sys->start_date - AOUT_PTS_TOLERANCE / 4 );
while ( !p_aout->b_die ) while ( !p_aout->b_die )
...@@ -773,6 +776,7 @@ static int ALSAThread( aout_instance_t * p_aout ) ...@@ -773,6 +776,7 @@ static int ALSAThread( aout_instance_t * p_aout )
ALSAFill( p_aout ); ALSAFill( p_aout );
} }
cleanup:
snd_pcm_drop( p_sys->p_snd_pcm ); snd_pcm_drop( p_sys->p_snd_pcm );
free( p_aout->output.p_sys->p_status ); free( p_aout->output.p_sys->p_status );
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment