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).
This commit is contained in:
Max Kellermann 2021-03-08 22:43:20 +01:00
parent 9ade93983c
commit 3a948515ce
1 changed files with 5 additions and 0 deletions

View File

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