Commit 9dc7b5a6 authored by Max Kellermann's avatar Max Kellermann

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.
parent f5d21c9c
...@@ -176,11 +176,13 @@ private: ...@@ -176,11 +176,13 @@ private:
} }
void ClearAndReplacePipe(MusicPipe *_pipe) { void ClearAndReplacePipe(MusicPipe *_pipe) {
ResetCrossFade();
ClearAndDeletePipe(); ClearAndDeletePipe();
pipe = _pipe; pipe = _pipe;
} }
void ReplacePipe(MusicPipe *_pipe) { void ReplacePipe(MusicPipe *_pipe) {
ResetCrossFade();
delete pipe; delete pipe;
pipe = _pipe; pipe = _pipe;
} }
...@@ -335,6 +337,11 @@ Player::StopDecoder() ...@@ -335,6 +337,11 @@ Player::StopDecoder()
delete dc.pipe; delete dc.pipe;
dc.pipe = nullptr; 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() ...@@ -599,7 +606,7 @@ Player::SeekDecoder()
player_command_finished(pc); player_command_finished(pc);
ResetCrossFade(); assert(xfade_state == CrossFadeState::UNKNOWN);
/* re-fill the buffer after seeking */ /* re-fill the buffer after seeking */
buffering = true; buffering = true;
...@@ -905,8 +912,6 @@ Player::PlayNextChunk() ...@@ -905,8 +912,6 @@ Player::PlayNextChunk()
inline bool inline bool
Player::SongBorder() Player::SongBorder()
{ {
ResetCrossFade();
FormatDefault(player_domain, "played \"%s\"", song->GetURI()); FormatDefault(player_domain, "played \"%s\"", song->GetURI());
ReplacePipe(dc.pipe); ReplacePipe(dc.pipe);
......
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