Commit 3a948515 authored by Max Kellermann's avatar Max Kellermann

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).
parent 9ade9398
...@@ -382,6 +382,10 @@ try { ...@@ -382,6 +382,10 @@ try {
} catch (...) { } catch (...) {
error.ptr = std::current_exception(); error.ptr = std::current_exception();
error.occur.store(true); error.occur.store(true);
/* wake up the client thread which may be inside
WaitDataPoped() */
data_poped.Set();
} }
AudioOutput * AudioOutput *
...@@ -609,6 +613,7 @@ WasapiOutput::Play(const void *chunk, size_t size) ...@@ -609,6 +613,7 @@ WasapiOutput::Play(const void *chunk, size_t size)
if (consumed_size == 0) { if (consumed_size == 0) {
assert(is_started); assert(is_started);
thread->Wait(); thread->Wait();
thread->CheckException();
if (!not_interrupted.test_and_set()) { if (!not_interrupted.test_and_set()) {
throw AudioOutputInterrupted{}; throw AudioOutputInterrupted{};
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment