output/wasapi: use default device only if none was configured

This commit is contained in:
Max Kellermann 2021-03-05 19:06:02 +01:00
parent 8b41c4f384
commit 17d4873b60
2 changed files with 6 additions and 6 deletions

1
NEWS
View File

@ -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

View File

@ -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);
}