From 3a948515ceccd0d2da44f5aad567d76a665e3d1a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 8 Mar 2021 22:43:20 +0100 Subject: [PATCH] output/wasapi: check for exceptions after Wait() This finishes problems which occur early in the WasapiOutputThread; previously, the error was ignored and the output blocked forever without doing anything (and without reporting the error). --- src/output/plugins/wasapi/WasapiOutputPlugin.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/output/plugins/wasapi/WasapiOutputPlugin.cxx b/src/output/plugins/wasapi/WasapiOutputPlugin.cxx index e08a4d985..ccf4f524c 100644 --- a/src/output/plugins/wasapi/WasapiOutputPlugin.cxx +++ b/src/output/plugins/wasapi/WasapiOutputPlugin.cxx @@ -382,6 +382,10 @@ try { } catch (...) { error.ptr = std::current_exception(); error.occur.store(true); + + /* wake up the client thread which may be inside + WaitDataPoped() */ + data_poped.Set(); } AudioOutput * @@ -609,6 +613,7 @@ WasapiOutput::Play(const void *chunk, size_t size) if (consumed_size == 0) { assert(is_started); thread->Wait(); + thread->CheckException(); if (!not_interrupted.test_and_set()) { throw AudioOutputInterrupted{}; }