From 17d4873b60e7b151ef8844f6bf35197061f8cdb6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 5 Mar 2021 19:06:02 +0100 Subject: [PATCH] output/wasapi: use default device only if none was configured --- NEWS | 1 + src/output/plugins/wasapi/WasapiOutputPlugin.cxx | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 4c0e93818..e139092bf 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ ver 0.22.7 (not yet released) - curl: don't use glibc extension * output - wasapi: add algorithm for finding usable audio format + - wasapi: use default device only if none was configured ver 0.22.6 (2021/02/16) * fix missing tags on songs in queue 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); }