diff options
author | Max Kellermann <max@musicpd.org> | 2018-01-29 22:30:56 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-01-29 22:30:56 +0100 |
commit | eb771eaf0d123b3aebbad71623938e9d9f8f6d5a (patch) | |
tree | 277894a9bc21acd6da532acaeafea596adabf565 /src/output | |
parent | 6908555ed38b243e77e6acb5b1f6d00d72ae147b (diff) |
output/Thread: re-lock the mutex after flush error
Fixes deadlock due to mutex double lock.
Diffstat (limited to 'src/output')
-rw-r--r-- | src/output/Thread.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/output/Thread.cxx b/src/output/Thread.cxx index 3fb17ae54..fe358ce2f 100644 --- a/src/output/Thread.cxx +++ b/src/output/Thread.cxx @@ -379,11 +379,11 @@ PlayFull(FilteredAudioOutput &output, ConstBuffer<void> _buffer) inline void AudioOutputControl::InternalDrain() noexcept { - const ScopeUnlock unlock(mutex); - try { /* flush the filter and play its remaining output */ + const ScopeUnlock unlock(mutex); + while (true) { auto buffer = source.Flush(); if (buffer.IsNull()) @@ -391,14 +391,14 @@ AudioOutputControl::InternalDrain() noexcept PlayFull(*output, buffer); } + + output->Drain(); } catch (...) { FormatError(std::current_exception(), "Failed to flush filter on %s", GetLogName()); InternalCloseError(std::current_exception()); return; } - - output->Drain(); } void |