From 17d4873b60e7b151ef8844f6bf35197061f8cdb6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 5 Mar 2021 19:06:02 +0100 Subject: output/wasapi: use default device only if none was configured --- src/output/plugins/wasapi/WasapiOutputPlugin.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/output/plugins') diff --git a/src/output/plugins/wasapi/WasapiOutputPlugin.cxx b/src/output/plugins/wasapi/WasapiOutputPlugin.cxx index 4c306989e..5c234db56 100644 --- a/src/output/plugins/wasapi/WasapiOutputPlugin.cxx +++ b/src/output/plugins/wasapi/WasapiOutputPlugin.cxx @@ -617,14 +617,13 @@ void WasapiOutput::OpenDevice() { if (!device_config.empty()) { if (!SafeSilenceTry([this, &id]() { id = std::stoul(device_config); })) { id = SearchDevice(device_config); + if (id == kErrorId) + throw FormatRuntimeError("Device '%s' not found", + device_config.c_str()); } - } - - if (id != kErrorId) { - SafeTry([this, id]() { GetDevice(id); }); - } - if (!device) { + GetDevice(id); + } else { device = GetDefaultAudioEndpoint(*enumerator); } -- cgit v1.2.3