[vlc-commits] wasapi: print an error rather than abort in volume setting error
Rémi Denis-Courmont
git at videolan.org
Wed Jul 25 16:23:57 CEST 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jul 25 17:16:38 2012 +0300| [8942c7d991c90472f51e3f0e3e502332f0bd6915] | committer: 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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8942c7d991c90472f51e3f0e3e502332f0bd6915
---
modules/audio_output/wasapi.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
index 11ec212..5853c53 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -190,10 +190,8 @@ static int SimpleVolumeSet(audio_output_t *aout, float vol)
aout_sys_t *sys = aout->sys;
HRESULT hr;
- if (vol > 1.)
- vol = 1.;
-
- Enter();
+ if (TryEnter(aout))
+ return -1;
hr = ISimpleAudioVolume_SetMasterVolume(sys->volume.simple, vol, NULL);
if (FAILED(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)
aout_sys_t *sys = aout->sys;
HRESULT hr;
- Enter();
+ if (TryEnter(aout))
+ return -1;
hr = ISimpleAudioVolume_SetMute(sys->volume.simple, mute, NULL);
if (FAILED(hr))
msg_Warn(aout, "cannot mute session (error 0x%lx)", hr);
More information about the vlc-commits
mailing list