From 32a5bf043b8be3195a718adfec425535c3608992 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 14 Apr 2020 16:03:49 +0200 Subject: [PATCH] player/Thread: drain outputs at end of song in "single" mode Without this, the Pause() call would drop the ring buffers and would skip a considerable portion of the end of the song. Closes https://github.com/MusicPlayerDaemon/MPD/issues/824 --- NEWS | 2 ++ src/player/Thread.cxx | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/NEWS b/NEWS index 184d6566c..d2f758909 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.21.23 (not yet released) +* player + - drain outputs at end of song in "single" mode ver 0.21.22 (2020/04/02) * database diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx index 64a502e6d..a10429472 100644 --- a/src/player/Thread.cxx +++ b/src/player/Thread.cxx @@ -964,6 +964,12 @@ Player::SongBorder() noexcept if (border_pause) { paused = true; pc.listener.OnBorderPause(); + + /* drain all outputs to guarantee the current song is + really being played to the end; without this, the + Pause() call would drop all ring buffers */ + pc.outputs.Drain(); + pc.outputs.Pause(); idle_add(IDLE_PLAYER); }