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

wasapi: log error if COM initialization fails

parent ae3fd827
...@@ -48,11 +48,17 @@ vlc_module_begin() ...@@ -48,11 +48,17 @@ vlc_module_begin()
set_callbacks(Open, Close) set_callbacks(Open, Close)
vlc_module_end() vlc_module_end()
static int TryEnter(void) static int TryEnter(vlc_object_t *obj)
{ {
HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); 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) static void Enter(void)
{ {
...@@ -461,7 +467,7 @@ static int Open(vlc_object_t *obj) ...@@ -461,7 +467,7 @@ static int Open(vlc_object_t *obj)
sys->done = NULL; sys->done = NULL;
aout->sys = sys; aout->sys = sys;
if (TryEnter()) if (TryEnter(aout))
{ {
free(sys); free(sys);
return VLC_EGENERIC; return VLC_EGENERIC;
......
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