Commit 15dcaeda authored by Max Kellermann's avatar Max Kellermann

output/Internal: remove mutex code from BeginPause(), IteratePause()

parent 8f42ba13
......@@ -120,7 +120,6 @@ AudioOutput::Close(bool drain) noexcept
void
AudioOutput::BeginPause() noexcept
{
const ScopeUnlock unlock(mutex);
ao_plugin_cancel(*this);
}
......@@ -128,7 +127,6 @@ bool
AudioOutput::IteratePause() noexcept
{
try {
const ScopeUnlock unlock(mutex);
return ao_plugin_pause(*this);
} catch (const std::runtime_error &e) {
FormatError(e, "\"%s\" [%s] failed to pause",
......
......@@ -343,7 +343,11 @@ AudioOutputControl::InternalPlay() noexcept
inline void
AudioOutputControl::InternalPause() noexcept
{
output->BeginPause();
{
const ScopeUnlock unlock(mutex);
output->BeginPause();
}
pause = true;
CommandFinished();
......@@ -352,14 +356,24 @@ AudioOutputControl::InternalPause() noexcept
if (!WaitForDelay())
break;
if (!output->IteratePause()) {
bool success;
{
const ScopeUnlock unlock(mutex);
success = output->IteratePause();
}
if (!success) {
InternalClose(false);
break;
}
} while (command == Command::NONE);
pause = false;
output->EndPause();
{
const ScopeUnlock unlock(mutex);
output->EndPause();
}
skip_delay = true;
}
......
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