| 628 | } |
| 629 | |
| 630 | void |
| 631 | DecoderControl::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 | } |
nothing calls this directly
no test coverage detected