Ignore low-FPS ranges if not available

Do not report an error if the returned FPS ranges array is null.

Refs #5669 <https://github.com/Genymobile/scrcpy/pull/5669>
This commit is contained in:
Romain Vimont 2024-12-22 21:17:51 +01:00
parent 2f44da76f4
commit 5387644160

View File

@ -163,8 +163,10 @@ public final class LogUtils {
try { try {
// Capture frame rates for low-FPS mode are the same for every resolution // 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); Range<Integer>[] lowFpsRanges = characteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);
if (lowFpsRanges != null) {
SortedSet<Integer> uniqueLowFps = getUniqueSet(lowFpsRanges); SortedSet<Integer> uniqueLowFps = getUniqueSet(lowFpsRanges);
builder.append(", fps=").append(uniqueLowFps); builder.append(", fps=").append(uniqueLowFps);
}
} catch (Exception e) { } catch (Exception e) {
// Some devices may provide invalid ranges, causing an IllegalArgumentException "lower must be less than or equal to upper" // 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); Ln.w("Could not get available frame rates for camera " + id, e);