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

wasapi: print an error rather than abort in volume setting error

Unfortunately, some callers cannot be trusted not to leak their COM
context, causing COM initialization to fail.
parent ebe79922
...@@ -190,10 +190,8 @@ static int SimpleVolumeSet(audio_output_t *aout, float vol) ...@@ -190,10 +190,8 @@ static int SimpleVolumeSet(audio_output_t *aout, float vol)
aout_sys_t *sys = aout->sys; aout_sys_t *sys = aout->sys;
HRESULT hr; HRESULT hr;
if (vol > 1.) if (TryEnter(aout))
vol = 1.; return -1;
Enter();
hr = ISimpleAudioVolume_SetMasterVolume(sys->volume.simple, vol, NULL); hr = ISimpleAudioVolume_SetMasterVolume(sys->volume.simple, vol, NULL);
if (FAILED(hr)) if (FAILED(hr))
msg_Warn(aout, "cannot set session volume (error 0x%lx)", hr); msg_Warn(aout, "cannot set session volume (error 0x%lx)", hr);
...@@ -206,7 +204,8 @@ static int SimpleMuteSet(audio_output_t *aout, bool mute) ...@@ -206,7 +204,8 @@ static int SimpleMuteSet(audio_output_t *aout, bool mute)
aout_sys_t *sys = aout->sys; aout_sys_t *sys = aout->sys;
HRESULT hr; HRESULT hr;
Enter(); if (TryEnter(aout))
return -1;
hr = ISimpleAudioVolume_SetMute(sys->volume.simple, mute, NULL); hr = ISimpleAudioVolume_SetMute(sys->volume.simple, mute, NULL);
if (FAILED(hr)) if (FAILED(hr))
msg_Warn(aout, "cannot mute session (error 0x%lx)", hr); msg_Warn(aout, "cannot mute session (error 0x%lx)", hr);
......
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