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

Commit a283192f authored by Marco Nelissen's avatar Marco Nelissen Committed by Android (Google) Code Review
Browse files

Merge "Fix crash when seeking fragmented mp4 files"

parents e9841c60 ebfd3230
Loading
Loading
Loading
Loading
+17 −10
Original line number Diff line number Diff line
@@ -3724,6 +3724,14 @@ status_t MPEG4Source::fragmentedRead(
            mCurrentSampleIndex = 0;
            parseChunk(&totalOffset);
            mCurrentTime = totalTime * mTimescale / 1000000ll;
        } else {
            // without sidx boxes, we can only seek to 0
            mCurrentMoofOffset = mFirstMoofOffset;
            mCurrentSamples.clear();
            mCurrentSampleIndex = 0;
            off64_t tmp = mCurrentMoofOffset;
            parseChunk(&tmp);
            mCurrentTime = 0;
        }

        if (mBuffer != NULL) {
@@ -3744,8 +3752,7 @@ status_t MPEG4Source::fragmentedRead(

        if (mCurrentSampleIndex >= mCurrentSamples.size()) {
            // move to next fragment
            Sample lastSample = mCurrentSamples[mCurrentSamples.size() - 1];
            off64_t nextMoof = mNextMoofOffset; // lastSample.offset + lastSample.size;
            off64_t nextMoof = mNextMoofOffset;
            mCurrentMoofOffset = nextMoof;
            mCurrentSamples.clear();
            mCurrentSampleIndex = 0;