summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-05-20 15:22:34 +0200
committerMax Kellermann <max@musicpd.org>2019-05-20 16:22:01 +0200
commit923e66738cb89590c3b83a853e3ece9964ffc56b (patch)
tree727f2967db761d9d381f57f4c407f4fd14f01424 /src
parentff3e2c05142c94efadee00812ec348c15f1be1ba (diff)
player/Thread: fix "single" mode race condition
If the decoder finishes decoding the current song between the two IsIdle() checks, MPD stops playback instead of starting the decoder for the next song. This is usually not visible problem, because the main thread restarts it via playlist::ResumePlayback(), but that way it, ignores "single" mode. As a workaround, this commit adds another "queued" check which re-enters the player loop and checks again whether to start the decoder. Closes https://github.com/MusicPlayerDaemon/MPD/issues/556
Diffstat (limited to 'src')
-rw-r--r--src/player/Thread.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx
index 81271a142..7d81011f6 100644
--- a/src/player/Thread.cxx
+++ b/src/player/Thread.cxx
@@ -1058,6 +1058,16 @@ Player::Run() noexcept
SongBorder();
} else if (dc.IsIdle()) {
+ if (queued)
+ /* the decoder has just stopped,
+ between the two IsIdle() checks,
+ probably while UnlockCheckOutputs()
+ left the mutex unlocked; to restart
+ the decoder instead of stopping
+ playback completely, let's re-enter
+ this loop */
+ continue;
+
/* check the size of the pipe again, because
the decoder thread may have added something
since we last checked */