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

Commit 38f4cbed authored by Hangyu Kuang's avatar Hangyu Kuang
Browse files

media: Save the last decode timestamp after all the timestamp adjustments.

Test: Keep taking pictures during video record for 5 mins.
Bug: 33882616
Change-Id: I2865a4842448ab9463391b983051cba243ea1ed6
parent e482d3a8
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -2725,9 +2725,11 @@ status_t MPEG4Writer::Track::threadEntry() {
            if (mLastDecodingTimeUs < 0) {
                decodingTimeUs = std::max((int64_t)0, decodingTimeUs);
            } else {
                // increase decoding time by at least 1 tick
                decodingTimeUs = std::max(
                        mLastDecodingTimeUs + divUp(1000000, mTimeScale), decodingTimeUs);
                // increase decoding time by at least the larger vaule of 1 tick and
                // 0.1 milliseconds. This needs to take into account the possible
                // delta adjustment in DurationTicks in below.
                decodingTimeUs = std::max(mLastDecodingTimeUs +
                        std::max(100, divUp(1000000, mTimeScale)), decodingTimeUs);
            }

            mLastDecodingTimeUs = decodingTimeUs;