vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Wed Nov 12 22:10:36 2014 +0200| [2d3723d149044db9dff5b05035c7efce5e5200f9] | committer: Rémi Denis-Courmont
directsound: fix uninitialized mutex and condition variable Regression from 3044105e9d4664609a7d749469fe0fd6d85e90ff. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2d3723d149044db9dff5b05035c7efce5e5200f9 --- modules/audio_output/directsound.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/audio_output/directsound.c b/modules/audio_output/directsound.c index 7db4458..db870f2 100644 --- a/modules/audio_output/directsound.c +++ b/modules/audio_output/directsound.c @@ -548,9 +548,12 @@ static HRESULT Stop( aout_stream_sys_t *p_sys ) vlc_mutex_lock( &p_sys->lock ); p_sys->b_playing = true; vlc_cond_signal( &p_sys->cond ); - vlc_cancel( p_sys->eraser_thread ); vlc_mutex_unlock( &p_sys->lock ); + vlc_cancel( p_sys->eraser_thread ); vlc_join( p_sys->eraser_thread, NULL ); + vlc_cond_destroy( &p_sys->cond ); + vlc_mutex_destroy( &p_sys->lock ); + if( p_sys->p_notify != NULL ) { IDirectSoundNotify_Release(p_sys->p_notify ); @@ -767,12 +770,19 @@ static HRESULT Start( vlc_object_t *obj, aout_stream_sys_t *sys, } } + vlc_mutex_init(&sys->lock); + vlc_cond_init(&sys->cond); + int ret = vlc_clone(&sys->eraser_thread, PlayedDataEraser, (void*) obj, VLC_THREAD_PRIORITY_LOW); if( unlikely( ret ) ) { if( ret != ENOMEM ) msg_Err( obj, "Couldn't start eraser thread" ); + + vlc_cond_destroy(&sys->cond); + vlc_mutex_destroy(&sys->lock); + if( sys->p_notify != NULL ) { IDirectSoundNotify_Release( sys->p_notify ); @@ -1087,9 +1097,6 @@ static int Open(vlc_object_t *obj) aout_DeviceReport(aout, dev); free(dev); - vlc_mutex_init(&sys->s.lock); - vlc_cond_init(&sys->s.cond); - return VLC_SUCCESS; } @@ -1097,8 +1104,6 @@ static void Close(vlc_object_t *obj) { audio_output_t *aout = (audio_output_t *)obj; aout_sys_t *sys = aout->sys; - vlc_cond_destroy( &sys->s.cond ); - vlc_mutex_destroy( &sys->s.lock ); var_Destroy(aout, "directx-audio-device"); FreeLibrary(sys->hdsound_dll); /* free DSOUND.DLL */ _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
