diff options
author | Max Kellermann <max@musicpd.org> | 2020-09-16 20:09:03 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-09-16 20:36:19 +0200 |
commit | 32f4f15831573c94e19fbd14f3c77d80a4408f2c (patch) | |
tree | 79a0d98b23b2f8ea81887edfdb052ce676d4f3c1 | |
parent | e29c06b718301562eebf2fa165f4017eae9407dc (diff) |
player/Thread: call OnPlayerSync() in SeekDecoder()
This fixes a spurious "single" mode bug which occurs when using "play"
or "seek" to start playback on the song that is currently paused: in
that case, the main thread never queues the next song, and at the end
of the song, the player thread exits Run(), stopping playback, and
after that, the main thread starts the next song without considering
"single" mode.
By calling OnPlayerSync(), we ensure that the main thread gets a
chance to queue the next song before the player thread exits the Run()
loop.
Closes https://github.com/MusicPlayerDaemon/MPD/issues/850
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/player/Thread.cxx | 6 |
2 files changed, 7 insertions, 0 deletions
@@ -12,6 +12,7 @@ ver 0.21.26 (not yet released) - ffmpeg: remove "rtsp://" from the list of supported protocols - ffmpeg: add "hls+http://" to the list of supported protocols - sndfile: fix lost samples at end of file +* fix "single" mode bug after resuming playback * the default log_level is "default", not "info" ver 0.21.25 (2020/07/06) diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx index 9f3fe23a1..6c7bab00d 100644 --- a/src/player/Thread.cxx +++ b/src/player/Thread.cxx @@ -681,6 +681,12 @@ Player::SeekDecoder() noexcept /* re-fill the buffer after seeking */ buffering = true; + { + /* call syncPlaylistWithQueue() in the main thread */ + const ScopeUnlock unlock(pc.mutex); + pc.listener.OnPlayerSync(); + } + return true; } |