Commit c46f9745 authored by Shen-Ta Hsieh's avatar Shen-Ta Hsieh Committed by Max Kellermann

src/output: Reopen device on error

parent 844dbd2e
......@@ -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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment