From f030b22bec85026926bbf459911edea6ea2a82c7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 25 Jul 2024 19:55:38 +0200 Subject: [PATCH] player/thread: wait for the first chunk in CheckCrossFade() This fixes MixRamp problems which occur because CheckCrossFade() is called before the decoder has parsed MixRamp tags after DecoderClient::Ready(). Closes https://github.com/MusicPlayerDaemon/MPD/issues/2084 --- NEWS | 1 + src/player/Thread.cxx | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 95e81b8c7..f4d1d1fd5 100644 --- a/NEWS +++ b/NEWS @@ -42,6 +42,7 @@ ver 0.24 (not yet released) - opus: implement bitrate calculation - sidplay: require libsidplayfp (drop support for the original sidplay) - wavpack: require libwavpack version 5 + - fix MixRamp bug * resampler - soxr: require libsoxr 0.1.2 or later * player diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx index 0be11354e..1a9de7235 100644 --- a/src/player/Thread.cxx +++ b/src/player/Thread.cxx @@ -857,9 +857,12 @@ Player::CheckCrossFade() noexcept return; } - if (!IsDecoderAtNextSong() || dc.IsStarting()) + if (!IsDecoderAtNextSong() || dc.IsStarting() || dc.pipe->IsEmpty()) /* we need information about the next song before we can decide */ + /* the "pipe.empty" check is here so we wait for all + (ReplayGain/MixRamp) metadata to appear, which some + decoders parse only after reporting readiness */ return; if (!pc.cross_fade.CanCrossFade(pc.total_time, dc.total_time,