Skip to content

Commit d251ce0

Browse files
committed
XAudio2: Don't quit on failed CoInitializeEx()
It returns an error code when already initialized
1 parent f42bebd commit d251ce0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/audio/XAudio2API.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ const std::vector<XAudio2API::DeviceDescriptionPtr>& XAudio2API::RefreshDevices(
187187
// this function must be called from the same thread as we called CoInitializeEx
188188
s_devices.clear();
189189

190-
if (FAILED(CoInitializeEx(nullptr, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE)))
190+
HRESULT r = CoInitializeEx(nullptr, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
191+
if (r != RPC_E_CHANGED_MODE && FAILED(r))
191192
return s_devices;
192193

193194
try

0 commit comments

Comments
 (0)