Commit e35772f8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

directsound: fix uninitialized mutex and condition variable

Regression from 3044105e.

(cherry picked from commit 2d3723d149044db9dff5b05035c7efce5e5200f9)
parent def455a1
......@@ -547,9 +547,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 );
......@@ -766,12 +769,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 );
......@@ -1086,9 +1096,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;
}
......@@ -1096,8 +1103,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 */
......
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