Commit 5990017d authored by Max Kellermann's avatar Max Kellermann

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

parent 3197c0fd
...@@ -32,7 +32,6 @@ void ...@@ -32,7 +32,6 @@ void
AudioOutput::Enable() AudioOutput::Enable()
{ {
try { try {
const ScopeUnlock unlock(mutex);
ao_plugin_enable(*this); ao_plugin_enable(*this);
} catch (const std::runtime_error &e) { } catch (const std::runtime_error &e) {
std::throw_with_nested(FormatRuntimeError("Failed to enable output \"%s\" [%s]", std::throw_with_nested(FormatRuntimeError("Failed to enable output \"%s\" [%s]",
...@@ -43,7 +42,6 @@ AudioOutput::Enable() ...@@ -43,7 +42,6 @@ AudioOutput::Enable()
void void
AudioOutput::Disable() noexcept AudioOutput::Disable() noexcept
{ {
const ScopeUnlock unlock(mutex);
ao_plugin_disable(*this); ao_plugin_disable(*this);
} }
......
...@@ -104,7 +104,11 @@ AudioOutputControl::InternalEnable() noexcept ...@@ -104,7 +104,11 @@ AudioOutputControl::InternalEnable() noexcept
last_error = nullptr; last_error = nullptr;
try { try {
output->Enable(); {
const ScopeUnlock unlock(mutex);
output->Enable();
}
really_enabled = true; really_enabled = true;
return true; return true;
} catch (const std::runtime_error &e) { } catch (const std::runtime_error &e) {
...@@ -124,6 +128,8 @@ AudioOutputControl::InternalDisable() noexcept ...@@ -124,6 +128,8 @@ AudioOutputControl::InternalDisable() noexcept
InternalCheckClose(false); InternalCheckClose(false);
really_enabled = false; really_enabled = false;
const ScopeUnlock unlock(mutex);
output->Disable(); output->Disable();
} }
......
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