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

Commit 607e379e authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "Properly honour any pending seek request when reading the first buffer after"

parents 2bb51bb2 5fd43e30
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -84,7 +84,13 @@ status_t AudioPlayer::start(bool sourceAlreadyStarted) {

    CHECK(mFirstBuffer == NULL);

    mFirstBufferResult = mSource->read(&mFirstBuffer);
    MediaSource::ReadOptions options;
    if (mSeeking) {
        options.setSeekTo(mSeekTimeUs);
        mSeeking = false;
    }

    mFirstBufferResult = mSource->read(&mFirstBuffer, &options);
    if (mFirstBufferResult == INFO_FORMAT_CHANGED) {
        LOGV("INFO_FORMAT_CHANGED!!!");

+13 −0
Original line number Diff line number Diff line
@@ -831,6 +831,8 @@ status_t AwesomePlayer::startAudioPlayer_l() {
    if (!(mFlags & AUDIOPLAYER_STARTED)) {
        mFlags |= AUDIOPLAYER_STARTED;

        bool wasSeeking = mAudioPlayer->isSeeking();

        // We've already started the MediaSource in order to enable
        // the prefetcher to read its data.
        status_t err = mAudioPlayer->start(
@@ -840,6 +842,13 @@ status_t AwesomePlayer::startAudioPlayer_l() {
            notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, err);
            return err;
        }

        if (wasSeeking) {
            CHECK(!mAudioPlayer->isSeeking());

            // We will have finished the seek while starting the audio player.
            postAudioSeekComplete_l();
        }
    } else {
        mAudioPlayer->resume();
    }
@@ -1957,6 +1966,10 @@ void AwesomePlayer::postAudioEOS(int64_t delayUs) {

void AwesomePlayer::postAudioSeekComplete() {
    Mutex::Autolock autoLock(mLock);
    postAudioSeekComplete_l();
}

void AwesomePlayer::postAudioSeekComplete_l() {
    postCheckAudioStatusEvent_l(0 /* delayUs */);
}

+1 −0
Original line number Diff line number Diff line
@@ -281,6 +281,7 @@ private:
    void ensureCacheIsFetching_l();

    status_t startAudioPlayer_l();
    void postAudioSeekComplete_l();

    void shutdownVideoDecoder_l();
    void setNativeWindow_l(const sp<ANativeWindow> &native);