From 93016ac6aba0053f1d740527c6c123a052d5e40d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 5 Mar 2021 19:33:22 +0100 Subject: [PATCH] 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. --- src/output/plugins/wasapi/WasapiOutputPlugin.cxx | 3 +++ 1 file changed, 3 insertions(+) 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; }