Commit 546b773b authored by Max Kellermann's avatar Max Kellermann

output/Internal: remove mutex code from Close()

parent 15dcaeda
...@@ -108,8 +108,6 @@ AudioOutput::CloseFilter() noexcept ...@@ -108,8 +108,6 @@ AudioOutput::CloseFilter() noexcept
void void
AudioOutput::Close(bool drain) noexcept AudioOutput::Close(bool drain) noexcept
{ {
const ScopeUnlock unlock(mutex);
CloseOutput(drain); CloseOutput(drain);
CloseFilter(); CloseFilter();
......
...@@ -142,6 +142,11 @@ public: ...@@ -142,6 +142,11 @@ public:
void Disable() noexcept; void Disable() noexcept;
/**
* Invoke OutputPlugin::close().
*
* Caller must not lock the mutex.
*/
void Close(bool drain) noexcept; void Close(bool drain) noexcept;
/** /**
......
...@@ -87,7 +87,12 @@ AudioOutputControl::InternalOpen2(const AudioFormat in_audio_format) ...@@ -87,7 +87,12 @@ AudioOutputControl::InternalOpen2(const AudioFormat in_audio_format)
output->out_audio_format); output->out_audio_format);
} catch (const std::runtime_error &e) { } catch (const std::runtime_error &e) {
open = false; open = false;
output->Close(false);
{
const ScopeUnlock unlock(mutex);
output->Close(false);
}
std::throw_with_nested(FormatRuntimeError("Failed to convert for \"%s\" [%s]", std::throw_with_nested(FormatRuntimeError("Failed to convert for \"%s\" [%s]",
GetName(), output->plugin.name)); GetName(), output->plugin.name));
} }
...@@ -194,7 +199,12 @@ AudioOutputControl::InternalClose(bool drain) noexcept ...@@ -194,7 +199,12 @@ AudioOutputControl::InternalClose(bool drain) noexcept
assert(IsOpen()); assert(IsOpen());
open = false; open = false;
output->Close(drain);
{
const ScopeUnlock unlock(mutex);
output->Close(drain);
}
source.Close(); source.Close();
} }
......
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