Commit eb771eaf authored by Max Kellermann's avatar Max Kellermann

output/Thread: re-lock the mutex after flush error

Fixes deadlock due to mutex double lock.
parent 6908555e
...@@ -379,11 +379,11 @@ PlayFull(FilteredAudioOutput &output, ConstBuffer<void> _buffer) ...@@ -379,11 +379,11 @@ PlayFull(FilteredAudioOutput &output, ConstBuffer<void> _buffer)
inline void inline void
AudioOutputControl::InternalDrain() noexcept AudioOutputControl::InternalDrain() noexcept
{ {
const ScopeUnlock unlock(mutex);
try { try {
/* flush the filter and play its remaining output */ /* flush the filter and play its remaining output */
const ScopeUnlock unlock(mutex);
while (true) { while (true) {
auto buffer = source.Flush(); auto buffer = source.Flush();
if (buffer.IsNull()) if (buffer.IsNull())
...@@ -391,14 +391,14 @@ AudioOutputControl::InternalDrain() noexcept ...@@ -391,14 +391,14 @@ AudioOutputControl::InternalDrain() noexcept
PlayFull(*output, buffer); PlayFull(*output, buffer);
} }
output->Drain();
} catch (...) { } catch (...) {
FormatError(std::current_exception(), FormatError(std::current_exception(),
"Failed to flush filter on %s", GetLogName()); "Failed to flush filter on %s", GetLogName());
InternalCloseError(std::current_exception()); InternalCloseError(std::current_exception());
return; return;
} }
output->Drain();
} }
void void
......
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