diff --git a/src/output/plugins/WasapiOutputPlugin.cxx b/src/output/plugins/WasapiOutputPlugin.cxx index b2833b2d9..b17c4ab7a 100644 --- a/src/output/plugins/WasapiOutputPlugin.cxx +++ b/src/output/plugins/WasapiOutputPlugin.cxx @@ -333,6 +333,15 @@ void WasapiOutput::DoOpen(AudioFormat &audio_format) { client.reset(); + DWORD state; + if (HRESULT result = device->GetState(&state); FAILED(result)) { + throw FormatHResultError(result, "Unable to get device status"); + } + if (state != DEVICE_STATE_ACTIVE) { + device.reset(); + OpenDevice(); + } + HRESULT result; result = device->Activate(__uuidof(IAudioClient), CLSCTX_ALL, nullptr, client.AddressCast());