output/wasapi: move catch block to the Work() function level

If an exception has been caught, the method cannot continue playback,
therefore it doesn't make sense to have the "catch" block inside the
"while" block (and not break the loop after catching an exception).
This commit is contained in:
Max Kellermann 2021-03-08 22:14:23 +01:00
parent 3a0dbb0a67
commit 9256190a9b

View File

@ -317,12 +317,11 @@ wasapi_output_get_client(WasapiOutput &output) noexcept
inline void
WasapiOutputThread::Work() noexcept
{
try {
SetThreadName("Wasapi Output Worker");
FormatDebug(wasapi_output_domain, "Working thread started");
COM com;
while (true) {
try {
event.Wait();
Status current_state = status.load();
@ -368,13 +367,12 @@ WasapiOutputThread::Work() noexcept
FormatDebug(wasapi_output_domain,
"Working thread paused");
}
}
} catch (...) {
error.ptr = std::current_exception();
error.occur.store(true);
error.thrown.Wait();
}
}
}
AudioOutput *
WasapiOutput::Create(EventLoop &, const ConfigBlock &block)