win32/Com: make COINIT_APARTMENTTHREADED the default constructor

This commit is contained in:
Max Kellermann 2021-03-08 14:02:16 +01:00
parent f2c679cfec
commit 927f1e03a3
3 changed files with 3 additions and 3 deletions

View File

@ -307,7 +307,7 @@ IAudioClient *wasapi_output_get_client(WasapiOutput &output) noexcept {
void WasapiOutputThread::Work() noexcept {
SetThreadName("Wasapi Output Worker");
FormatDebug(wasapi_output_domain, "Working thread started");
COM com{true};
COM com;
while (true) {
try {
event.Wait();

View File

@ -28,7 +28,7 @@
// https://docs.microsoft.com/en-us/windows/win32/api/_com/
class COM {
public:
COM(bool) {
COM() {
if (HRESULT result = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
FAILED(result)) {
throw MakeHResultError(

View File

@ -25,7 +25,7 @@ void
COMWorker::Work() noexcept
{
SetThreadName("COM Worker");
COM com{true};
COM com;
while (true) {
if (!running_flag.test_and_set()) {
return;