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

Commit 86355f5b authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Fix timestamps after seek

Ensure buffers are correctly timestamped after a seek.

Change-Id: I7d76689138e4f95c0ceb9fb7a4c4d42c48568212
parent ae162976
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -319,8 +319,7 @@ status_t FragmentedMP4Parser::onSeekTo(bool wantAudio, int64_t position) {
        off_t totalOffset = mFirstMoofOffset;
        for (int i = 0; i < numSidxEntries; i++) {
            const SidxEntry *se = &info->mSidx[i];
            totalTime += se->mDurationUs;
            if (totalTime > position) {
            if (totalTime + se->mDurationUs > position) {
                mBuffer->setRange(0,0);
                mBufferPos = totalOffset;
                if (mFinalResult == ERROR_END_OF_STREAM) {
@@ -329,9 +328,10 @@ status_t FragmentedMP4Parser::onSeekTo(bool wantAudio, int64_t position) {
                    resumeIfNecessary();
                }
                info->mFragments.clear();
                info->mDecodingTime = position * info->mMediaTimeScale / 1000000ll;
                info->mDecodingTime = totalTime * info->mMediaTimeScale / 1000000ll;
                return OK;
            }
            totalTime += se->mDurationUs;
            totalOffset += se->mSize;
        }
    }