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

Commit aec8d82d authored by Wei Jia's avatar Wei Jia
Browse files

NuPlayer: fix out of range seeking in audio

Also allow media time to move forward when switching from a/v to video
only.
Test: media time is correct when playing and seeking
Bug: 63397228

Change-Id: I14317bb4f3daa210e7b0323ef2d4daf5e298d91c
parent 52f34c89
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1234,7 +1234,7 @@ status_t NuPlayer::GenericSource::doSeek(int64_t seekTimeUs, MediaPlayerSeekMode
    }

    if (mAudioTrack.mSource != NULL) {
        readBuffer(MEDIA_TRACK_TYPE_AUDIO, seekTimeUs);
        readBuffer(MEDIA_TRACK_TYPE_AUDIO, seekTimeUs, MediaPlayerSeekMode::SEEK_CLOSEST);
        mAudioLastDequeueTimeUs = seekTimeUs;
    }

+9 −1
Original line number Diff line number Diff line
@@ -750,12 +750,20 @@ bool NuPlayer::Decoder::handleAnOutputBuffer(

        buffer->meta()->setInt32("eos", true);
        reply->setInt32("eos", true);
    } else if (mSkipRenderingUntilMediaTimeUs >= 0) {
    }

    if (mSkipRenderingUntilMediaTimeUs >= 0) {
        if (timeUs < mSkipRenderingUntilMediaTimeUs) {
            ALOGV("[%s] dropping buffer at time %lld as requested.",
                     mComponentName.c_str(), (long long)timeUs);

            reply->post();
            if (eos) {
                notifyResumeCompleteIfNecessary();
                if (mRenderer != NULL && !isDiscontinuityPending()) {
                    mRenderer->queueEOS(mIsAudio, ERROR_END_OF_STREAM);
                }
            }
            return true;
        }

+1 −0
Original line number Diff line number Diff line
@@ -1429,6 +1429,7 @@ void NuPlayer::Renderer::notifyEOS_l(bool audio, status_t finalResult, int64_t d
    if (audio) {
        // Video might outlive audio. Clear anchor to enable video only case.
        mAnchorTimeMediaUs = -1;
        mHasAudio = false;
    }
}