output/Internal: remove mutex code from Enable() and Disable()

This commit is contained in:
Max Kellermann 2017-08-07 17:39:20 +02:00
parent 3197c0fd7d
commit 5990017d51
2 changed files with 7 additions and 3 deletions

View File

@ -32,7 +32,6 @@ void
AudioOutput::Enable()
{
try {
const ScopeUnlock unlock(mutex);
ao_plugin_enable(*this);
} catch (const std::runtime_error &e) {
std::throw_with_nested(FormatRuntimeError("Failed to enable output \"%s\" [%s]",
@ -43,7 +42,6 @@ AudioOutput::Enable()
void
AudioOutput::Disable() noexcept
{
const ScopeUnlock unlock(mutex);
ao_plugin_disable(*this);
}

View File

@ -104,7 +104,11 @@ AudioOutputControl::InternalEnable() noexcept
last_error = nullptr;
try {
output->Enable();
{
const ScopeUnlock unlock(mutex);
output->Enable();
}
really_enabled = true;
return true;
} catch (const std::runtime_error &e) {
@ -124,6 +128,8 @@ AudioOutputControl::InternalDisable() noexcept
InternalCheckClose(false);
really_enabled = false;
const ScopeUnlock unlock(mutex);
output->Disable();
}