[vlc-devel] commit: ALSA: fix signaling race condition ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Aug 30 22:23:05 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Aug 30 23:21:15 2009 +0300| [8a624dc920f220e2f9e9f496499745d78e1ec07e] | committer: Rémi Denis-Courmont 

ALSA: fix signaling race condition

start_date must be set with the lock held. Otherwise, the condition
statement inside the ALSAThread while() startup loop may fail.
Once signaled, start_date belongs to the ALSA thread, so locking is not
needed anymore.

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

 modules/audio_output/alsa.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index a1d770d..1adb6d4 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -690,11 +690,11 @@ static void Play( aout_instance_t *p_aout )
         p_aout->output.p_sys->b_playing = true;
 
         /* get the playing date of the first aout buffer */
+        vlc_mutex_lock( &p_aout->output.p_sys->lock );
         p_aout->output.p_sys->start_date =
             aout_FifoFirstDate( p_aout, &p_aout->output.fifo );
 
         /* wake up the audio output thread */
-        vlc_mutex_lock( &p_aout->output.p_sys->lock );
         vlc_cond_signal( &p_aout->output.p_sys->wait );
         vlc_mutex_unlock( &p_aout->output.p_sys->lock );
     }




More information about the vlc-devel mailing list