diff options
author | Max Kellermann <max@duempel.org> | 2015-10-27 22:11:56 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-10-27 22:11:56 +0100 |
commit | 9dc7b5a6d99b6a7bc691663cee7d5748489d3d62 (patch) | |
tree | 4e01380d8fc4100632ab379bfb7776c28d62bae7 | |
parent | f5d21c9cdbc16096086301387a7c37489788c0ad (diff) | |
download | mpd-9dc7b5a6d99b6a7bc691663cee7d5748489d3d62.tar.gz mpd-9dc7b5a6d99b6a7bc691663cee7d5748489d3d62.tar.xz mpd-9dc7b5a6d99b6a7bc691663cee7d5748489d3d62.zip |
player/Thread: move ResetCrossFade() calls to where pipes are set
Move ResetCrossFade() to where cross-fading would actually break, to
make the cross-fading state more reliable.
-rw-r--r-- | src/player/Thread.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx index 81248c826..a89724ae8 100644 --- a/src/player/Thread.cxx +++ b/src/player/Thread.cxx @@ -176,11 +176,13 @@ private: } void ClearAndReplacePipe(MusicPipe *_pipe) { + ResetCrossFade(); ClearAndDeletePipe(); pipe = _pipe; } void ReplacePipe(MusicPipe *_pipe) { + ResetCrossFade(); delete pipe; pipe = _pipe; } @@ -335,6 +337,11 @@ Player::StopDecoder() delete dc.pipe; dc.pipe = nullptr; + + /* just in case we've been cross-fading: cancel it + now, because we just deleted the new song's decoder + pipe */ + ResetCrossFade(); } } @@ -599,7 +606,7 @@ Player::SeekDecoder() player_command_finished(pc); - ResetCrossFade(); + assert(xfade_state == CrossFadeState::UNKNOWN); /* re-fill the buffer after seeking */ buffering = true; @@ -905,8 +912,6 @@ Player::PlayNextChunk() inline bool Player::SongBorder() { - ResetCrossFade(); - FormatDefault(player_domain, "played \"%s\"", song->GetURI()); ReplacePipe(dc.pipe); |