[vlc-commits] wasapi: log error if COM initialization fails

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:15 2012 +0300| [ebe79922fd8fb67b228372ac61c04739eb2ac1e0] | committer: Rémi Denis-Courmont

wasapi: log error if COM initialization fails

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

 modules/audio_output/wasapi.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
index 065a942..11ec212 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -48,11 +48,17 @@ vlc_module_begin()
     set_callbacks(Open, Close)
 vlc_module_end()
 
-static int TryEnter(void)
+static int TryEnter(vlc_object_t *obj)
 {
     HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
-    return -!!FAILED(hr);
+    if (unlikely(FAILED(hr)))
+    {
+        msg_Err (obj, "cannot initialize COM (error 0x%lx)", hr);
+        return -1;
+    }
+    return 0;
 }
+#define TryEnter(o) TryEnter(VLC_OBJECT(o))
 
 static void Enter(void)
 {
@@ -461,7 +467,7 @@ static int Open(vlc_object_t *obj)
     sys->done = NULL;
     aout->sys = sys;
 
-    if (TryEnter())
+    if (TryEnter(aout))
     {
         free(sys);
         return VLC_EGENERIC;



More information about the vlc-commits mailing list