player/Thread: do not start the decoder twice
Upon receiving PlayerCommand::QUEUE, call StartDecoder() only if the decoder is not already starting. Checking just DecoderControl::IsIdle() is not enough because the decoder may already have finished decoding the song before the player has started playing it and before it had a chance to call CheckDecoderStartup(). Omitting the StartDecoder() call now means it will be started later in the Run() main loop, after CheckDecoderStartup() has succeeded (which effectively switches to the song that has already been decoded by the current decoder). This fixes an assertion failure when compiled in debug mode (`-Db_ndebug=false`) and random noise playback in non-debug mode (`-Db_ndebug=true`). Closes https://github.com/MusicPlayerDaemon/MPD/issues/1900
This commit is contained in:
parent
c8ece786dd
commit
7236f83999
|
@ -785,7 +785,7 @@ Player::ProcessCommand(std::unique_lock<Mutex> &lock) noexcept
|
|||
queued = true;
|
||||
pc.CommandFinished();
|
||||
|
||||
if (dc.IsIdle())
|
||||
if (!decoder_starting && dc.IsIdle())
|
||||
StartDecoder(lock, std::make_shared<MusicPipe>(),
|
||||
false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue