Commit 6fcddaf8 authored by Max Kellermann's avatar Max Kellermann

output/Thread: use AtScopeExit() to revert the in_playback_loop flag

parent 41fd583f
......@@ -35,6 +35,7 @@
#include "thread/Slack.hxx"
#include "thread/Name.hxx"
#include "util/ConstBuffer.hxx"
#include "util/ScopeExit.hxx"
#include "Log.hxx"
#include "Compiler.h"
......@@ -487,6 +488,11 @@ AudioOutput::Play()
assert(!in_playback_loop);
in_playback_loop = true;
AtScopeExit(this) {
assert(in_playback_loop);
in_playback_loop = false;
};
while (chunk != nullptr && command == Command::NONE) {
if (!PlayChunk(chunk))
break;
......@@ -495,9 +501,6 @@ AudioOutput::Play()
chunk = pipe.Get();
}
assert(in_playback_loop);
in_playback_loop = false;
const ScopeUnlock unlock(mutex);
player_control->LockSignal();
......
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