Display and control your Android device
Recover on invalid camera FPS ranges
Romain Vimont11d738321f86
diff --git a/server/src/main/java/com/genymobile/scrcpy/LogUtils.java b/server/src/main/java/com/genymobile/scrcpy/LogUtils.javaindex 70140525..efa0672b 100644--- a/server/src/main/java/com/genymobile/scrcpy/LogUtils.java+++ b/server/src/main/java/com/genymobile/scrcpy/LogUtils.java@@ -100,12 +100,19 @@ public final class LogUtils {builder.append(" (").append(getCameraFacingName(facing)).append(", ");Rect activeSize = characteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);- builder.append(activeSize.width()).append("x").append(activeSize.height()).append(", ");+ builder.append(activeSize.width()).append("x").append(activeSize.height());++ try {+ // Capture frame rates for low-FPS mode are the same for every resolution+ Range<Integer>[] lowFpsRanges = characteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);+ SortedSet<Integer> uniqueLowFps = getUniqueSet(lowFpsRanges);+ builder.append(", fps=").append(uniqueLowFps);+ } catch (Exception e) {+ // Some devices may provide invalid ranges, causing an IllegalArgumentException "lower must be less than or equal to upper"+ Ln.w("Could not get available frame rates for camera " + id, e);+ }- // Capture frame rates for low-FPS mode are the same for every resolution- Range<Integer>[] lowFpsRanges = characteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);- SortedSet<Integer> uniqueLowFps = getUniqueSet(lowFpsRanges);- builder.append("fps=").append(uniqueLowFps).append(')');+ builder.append(')');if (includeSizes) {StreamConfigurationMap configs = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);