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

Commit 904fb9aa authored by Dan Austin's avatar Dan Austin Committed by android-build-merger
Browse files

Merge "Fix benign integer overflow conditions for VSYNC add and removal." am: 34efca16

am: 7e6af732

* commit '7e6af732':
  Fix benign integer overflow conditions for VSYNC add and removal.
parents 1274bd55 7e6af732
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -460,6 +460,7 @@ nsecs_t VideoFrameScheduler::schedule(nsecs_t renderTime) {
                mTimeCorrection -= mVsyncPeriod / 2;
                mTimeCorrection -= mVsyncPeriod / 2;
                renderTime -= mVsyncPeriod / 2;
                renderTime -= mVsyncPeriod / 2;
                nextVsyncTime -= mVsyncPeriod;
                nextVsyncTime -= mVsyncPeriod;
                if (vsyncsForLastFrame > 0)
                    --vsyncsForLastFrame;
                    --vsyncsForLastFrame;
            } else if (mTimeCorrection < -correctionLimit &&
            } else if (mTimeCorrection < -correctionLimit &&
                    (vsyncsPerFrameAreNearlyConstant || vsyncsForLastFrame == minVsyncsPerFrame)) {
                    (vsyncsPerFrameAreNearlyConstant || vsyncsForLastFrame == minVsyncsPerFrame)) {
@@ -467,6 +468,7 @@ nsecs_t VideoFrameScheduler::schedule(nsecs_t renderTime) {
                mTimeCorrection += mVsyncPeriod / 2;
                mTimeCorrection += mVsyncPeriod / 2;
                renderTime += mVsyncPeriod / 2;
                renderTime += mVsyncPeriod / 2;
                nextVsyncTime += mVsyncPeriod;
                nextVsyncTime += mVsyncPeriod;
                if (vsyncsForLastFrame < ULONG_MAX)
                    ++vsyncsForLastFrame;
                    ++vsyncsForLastFrame;
            }
            }
            ATRACE_INT("FRAME_VSYNCS", vsyncsForLastFrame);
            ATRACE_INT("FRAME_VSYNCS", vsyncsForLastFrame);