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

Commit 08160fd9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "MPEG4Writer: Fix unsigned integer overflow" into main am: 5cb3691c am: 9db11468

parents 44e5792c 9db11468
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -4886,8 +4886,15 @@ void MPEG4Writer::Track::writeEdtsBox() {
            int32_t mediaTime = (mFirstSampleStartOffsetUs * mTimeScale + 5E5) / 1E6;
            int32_t firstSampleOffsetTicks =
                    (mFirstSampleStartOffsetUs * mvhdTimeScale + 5E5) / 1E6;
            // samples before 0 don't count in for duration, hence subtract firstSampleOffsetTicks.
            if (tkhdDurationTicks >= firstSampleOffsetTicks) {
                // samples before 0 don't count in for duration, hence subtract
                // firstSampleOffsetTicks.
                addOneElstTableEntry(tkhdDurationTicks - firstSampleOffsetTicks, mediaTime, 1, 0);
            } else {
                ALOGW("The track header duration %" PRId64
                      " is smaller than the first sample offset %" PRId64,
                      mTrackDurationUs, mFirstSampleStartOffsetUs);
            }
        } else {
            // Track starting at zero.
            ALOGV("No edit list entry required for this track");