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

Commit bd8158a5 authored by Santhosh Behara's avatar Santhosh Behara Committed by Linux Build Service Account
Browse files

libstagefright: Avoid negative values for cttsOffsetTimeUs

While calculating cttsOffsetTimeUs, it can go negative when the
the source drops frames, in such cases force it to 0.

Change-Id: I232bf60d709a1dced8ee36624e09bbfc212742c1
parent ffd20b9a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2487,6 +2487,9 @@ status_t MPEG4Writer::Track::threadEntry() {
            decodingTimeUs -= previousPausedDurationUs;
            cttsOffsetTimeUs =
                    timestampUs + mCttsOffsetTimeUs - decodingTimeUs;
            if (cttsOffsetTimeUs < 0) {
                cttsOffsetTimeUs = 0;
            }
            if (WARN_UNLESS(cttsOffsetTimeUs >= 0ll, "for %s track", trackName)) {
                copy->release();
                return ERROR_MALFORMED;