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:
parent
3a0dbb0a67
commit
9256190a9b
@ -317,12 +317,11 @@ wasapi_output_get_client(WasapiOutput &output) noexcept
|
|||||||
|
|
||||||
inline void
|
inline void
|
||||||
WasapiOutputThread::Work() noexcept
|
WasapiOutputThread::Work() noexcept
|
||||||
{
|
try {
|
||||||
SetThreadName("Wasapi Output Worker");
|
SetThreadName("Wasapi Output Worker");
|
||||||
FormatDebug(wasapi_output_domain, "Working thread started");
|
FormatDebug(wasapi_output_domain, "Working thread started");
|
||||||
COM com;
|
COM com;
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
|
||||||
event.Wait();
|
event.Wait();
|
||||||
|
|
||||||
Status current_state = status.load();
|
Status current_state = status.load();
|
||||||
@ -368,13 +367,12 @@ WasapiOutputThread::Work() noexcept
|
|||||||
FormatDebug(wasapi_output_domain,
|
FormatDebug(wasapi_output_domain,
|
||||||
"Working thread paused");
|
"Working thread paused");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
error.ptr = std::current_exception();
|
error.ptr = std::current_exception();
|
||||||
error.occur.store(true);
|
error.occur.store(true);
|
||||||
error.thrown.Wait();
|
error.thrown.Wait();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AudioOutput *
|
AudioOutput *
|
||||||
WasapiOutput::Create(EventLoop &, const ConfigBlock &block)
|
WasapiOutput::Create(EventLoop &, const ConfigBlock &block)
|
||||||
|
Loading…
Reference in New Issue
Block a user