MCPcopy Create free account
hub / github.com/MusicPlayerDaemon/MPD / RunThread

Method RunThread

src/decoder/Thread.cxx:630–680  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

628}
629
630void
631DecoderControl::RunThread() noexcept
632{
633 SetThreadName("decoder");
634
635 std::unique_lock lock{mutex};
636
637 do {
638 assert(state == DecoderState::STOP ||
639 state == DecoderState::ERROR);
640
641 switch (command) {
642 case DecoderCommand::START:
643 CycleMixRamp();
644 replay_gain_prev_db = replay_gain_db;
645 replay_gain_db = 0;
646
647 decoder_run(*this);
648
649 if (state == DecoderState::ERROR) {
650 try {
651 std::rethrow_exception(error);
652 } catch (...) {
653 LogError(std::current_exception());
654 }
655 }
656
657 break;
658
659 case DecoderCommand::SEEK:
660 /* this seek was too late, and the decoder had
661 already finished; start a new decoder */
662
663 /* we need to clear the pipe here; usually the
664 PlayerThread is responsible, but it is not
665 aware that the decoder has finished */
666 pipe->Clear();
667
668 decoder_run(*this);
669 break;
670
671 case DecoderCommand::STOP:
672 CommandFinishedLocked();
673 break;
674
675 case DecoderCommand::NONE:
676 Wait(lock);
677 break;
678 }
679 } while (command != DecoderCommand::NONE || !quit);
680}

Callers

nothing calls this directly

Calls 2

decoder_runFunction · 0.85
ClearMethod · 0.45

Tested by

no test coverage detected