Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4da004d authored by Ronghua Wu's avatar Ronghua Wu Committed by Android (Google) Code Review
Browse files

Merge "NuPlayer: add audioDecoderStillNeeded." into lmp-dev

parents f0011d49 d7988b1a
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -1048,9 +1048,9 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
            } else {
                ALOGW("resume called when source is gone or not set");
            }
            // |mAudioDecoder| may have been released due to the pause timeout, so try to re-create
            // it if needed.
            if (mFlushingAudio != SHUT_DOWN) {
            // |mAudioDecoder| may have been released due to the pause timeout, so re-create it if
            // needed.
            if (audioDecoderStillNeeded() && mAudioDecoder == NULL) {
                instantiateDecoder(true /* audio */, &mAudioDecoder);
            }
            if (mRenderer != NULL) {
@@ -1079,6 +1079,11 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
    }
}

bool NuPlayer::audioDecoderStillNeeded() {
    // Audio decoder is no longer needed if it's in shut/shutting down status.
    return ((mFlushingAudio != SHUT_DOWN) && (mFlushingAudio != SHUTTING_DOWN_DECODER));
}

void NuPlayer::finishFlushIfPossible() {
    if (mFlushingAudio != NONE && mFlushingAudio != FLUSHED
            && mFlushingAudio != SHUT_DOWN) {
+2 −0
Original line number Diff line number Diff line
@@ -203,6 +203,8 @@ private:

    void finishFlushIfPossible();

    bool audioDecoderStillNeeded();

    void flushDecoder(
            bool audio, bool needShutdown, const sp<AMessage> &newFormat = NULL);
    void updateDecoderFormatWithoutFlush(bool audio, const sp<AMessage> &format);