From 19b8032d06c78eea039010390332423a03f2da1e Mon Sep 17 00:00:00 2001 From: Chase Payne Date: Tue, 12 Jul 2022 16:19:28 -0500 Subject: [PATCH] Fixes an issue that caused televisions to have frame pacing problems when setting the refresh rate below 50hz --- app/src/main/java/com/limelight/Game.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/com/limelight/Game.java b/app/src/main/java/com/limelight/Game.java index 1d70130b..baf0bc20 100644 --- a/app/src/main/java/com/limelight/Game.java +++ b/app/src/main/java/com/limelight/Game.java @@ -712,6 +712,8 @@ public class Game extends Activity implements SurfaceHolder.Callback, boolean isNativeResolutionStream = PreferenceConfiguration.isNativeResolution(prefConfig.width, prefConfig.height); boolean refreshRateIsGood = isRefreshRateGoodMatch(bestMode.getRefreshRate()); boolean refreshRateIsEqual = isRefreshRateEqualMatch(bestMode.getRefreshRate()); + boolean isTelevision = getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK); + for (Display.Mode candidate : display.getSupportedModes()) { boolean refreshRateReduced = candidate.getRefreshRate() < bestMode.getRefreshRate(); boolean resolutionReduced = candidate.getPhysicalWidth() < bestMode.getPhysicalWidth() || @@ -766,6 +768,14 @@ public class Game extends Activity implements SurfaceHolder.Callback, else if (!isRefreshRateEqualMatch(candidate.getRefreshRate())) { continue; } + + // For refresh rates lower than 50hz, we want to check if the device is a TV. + // Some TV's may have issues when attempting to lower its refresh rate + // As opposed to mobile devices, which are designed to lower refresh rate + // for battery life reasons. + else if(isTelevision && candidate.getRefreshRate() < 50) { + continue; + } } } else if (!isRefreshRateGoodMatch(candidate.getRefreshRate())) {