Skip to content

Commit

Permalink
XAudio2: Don't quit on failed CoInitializeEx()
Browse files Browse the repository at this point in the history
It returns an error code when already initialized
  • Loading branch information
Exzap committed Oct 13, 2022
1 parent f42bebd commit d251ce0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/audio/XAudio2API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ const std::vector<XAudio2API::DeviceDescriptionPtr>& XAudio2API::RefreshDevices(
// this function must be called from the same thread as we called CoInitializeEx
s_devices.clear();

if (FAILED(CoInitializeEx(nullptr, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE)))
HRESULT r = CoInitializeEx(nullptr, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
if (r != RPC_E_CHANGED_MODE && FAILED(r))
return s_devices;

try
Expand Down

0 comments on commit d251ce0

Please sign in to comment.