summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2021-03-05 19:33:22 +0100
committerMax Kellermann <max@musicpd.org>2021-03-05 19:33:38 +0100
commit93016ac6aba0053f1d740527c6c123a052d5e40d (patch)
tree98a3ea777faacda9f27c3a14710863a52ad3366e
parentfc20a1f10a79a84a081c177eeb2b74c91660d8d1 (diff)
output/wasapi: check AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED
Stop early, don't try more formats if it is clear that we have no chance.
-rw-r--r--src/output/plugins/wasapi/WasapiOutputPlugin.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/output/plugins/wasapi/WasapiOutputPlugin.cxx b/src/output/plugins/wasapi/WasapiOutputPlugin.cxx
index 23c0e88e2..9a3616817 100644
--- a/src/output/plugins/wasapi/WasapiOutputPlugin.cxx
+++ b/src/output/plugins/wasapi/WasapiOutputPlugin.cxx
@@ -642,6 +642,9 @@ bool WasapiOutput::TryFormatExclusive(const AudioFormat &audio_format) {
device_format = test_format;
return true;
}
+
+ if (result == AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED)
+ throw std::runtime_error("Exclusive mode not allowed");
}
return false;
}