SurfaceFlinger: clamp frame refresh duration to min refresh duration
am: cdd0f9d88e
Change-Id: If41bf13911c9d8c9411ba87a7766cf8bc450926b
diff --git a/services/surfaceflinger/Scheduler/LayerInfo.cpp b/services/surfaceflinger/Scheduler/LayerInfo.cpp
index e782dd5..723d71f 100644
--- a/services/surfaceflinger/Scheduler/LayerInfo.cpp
+++ b/services/surfaceflinger/Scheduler/LayerInfo.cpp
@@ -49,7 +49,7 @@
mLastPresentTime = lastPresentTime;
// Ignore time diff that are too high - those are stale values
if (timeDiff > OBSOLETE_TIME_EPSILON_NS.count()) return;
- const nsecs_t refreshDuration = (timeDiff > 0) ? timeDiff : mMinRefreshDuration;
+ const nsecs_t refreshDuration = std::max(timeDiff, mMinRefreshDuration);
const int fps = 1e9f / refreshDuration;
mRefreshRateHistory.insertRefreshRate(fps);
}