[vlc-commits] mmdevice: fix error handling
Rémi Denis-Courmont
git at videolan.org
Sat Jul 13 10:42:08 CEST 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jul 13 11:33:02 2019 +0300| [87ea7ad173e71301bb10477079ce77b69fd706cb] | committer: Rémi Denis-Courmont
mmdevice: fix error handling
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=87ea7ad173e71301bb10477079ce77b69fd706cb
---
modules/audio_output/mmdevice.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index c9f0d5016c..70563acad9 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -1395,14 +1395,23 @@ static void Reload_DevicesEnum_Added(void *data, LPCWSTR wid, IMMDevice *dev)
static int ReloadAudioDevices(char const *name, char ***values, char ***descs)
{
+ bool in_mta = true;
+ HRESULT hr;
+
(void) name;
- bool in_mta = SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED));
+ hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ if (FAILED(hr)) {
+ if (hr != RPC_E_CHANGED_MODE)
+ return -1;
+
+ in_mta = false;
+ }
struct mm_list list = { .count = 0 };
void *it;
- HRESULT hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
- &IID_IMMDeviceEnumerator, &it);
+ hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
+ &IID_IMMDeviceEnumerator, &it);
if (FAILED(hr))
goto error;
More information about the vlc-commits
mailing list