summaryrefslogtreecommitdiff
path: root/src/output/plugins
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2021-03-05 19:06:02 +0100
committerMax Kellermann <max@musicpd.org>2021-03-05 19:25:42 +0100
commit17d4873b60e7b151ef8844f6bf35197061f8cdb6 (patch)
tree81d0a77b77e05fec8e3a0cf5c06ed7e5af91779b /src/output/plugins
parent8b41c4f3848c646425548ad19aeb245d2b5acc6e (diff)
output/wasapi: use default device only if none was configured
Diffstat (limited to 'src/output/plugins')
-rw-r--r--src/output/plugins/wasapi/WasapiOutputPlugin.cxx11
1 files changed, 5 insertions, 6 deletions
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);
}