Commit 923e6673 authored by Max Kellermann's avatar Max Kellermann

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
parent ff3e2c05
...@@ -4,6 +4,7 @@ ver 0.21.9 (not yet released) ...@@ -4,6 +4,7 @@ ver 0.21.9 (not yet released)
* Android * Android
- fix crash on ARMv7 - fix crash on ARMv7
- request storage permission on Android 6+ - request storage permission on Android 6+
* fix spurious "single" mode bug
ver 0.21.8 (2019/04/23) ver 0.21.8 (2019/04/23)
* input * input
......
...@@ -1058,6 +1058,16 @@ Player::Run() noexcept ...@@ -1058,6 +1058,16 @@ Player::Run() noexcept
SongBorder(); SongBorder();
} else if (dc.IsIdle()) { } 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 /* check the size of the pipe again, because
the decoder thread may have added something the decoder thread may have added something
since we last checked */ since we last checked */
......
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