mirror of
https://github.com/Genymobile/scrcpy.git
synced 2024-09-19 05:31:21 +02:00
Recover on invalid camera FPS ranges
Some devices may provide invalid ranges, causing an IllegalArgumentException "lower must be less than or equal to upper". Catch the exception to list the cameras anyway. Refs #4403 <https://github.com/Genymobile/scrcpy/issues/4403>
This commit is contained in:
parent
ad8ced5b1e
commit
dedbc3f8cd
1 changed files with 12 additions and 5 deletions
|
@ -104,12 +104,19 @@ public final class LogUtils {
|
||||||
builder.append(" (").append(getCameraFacingName(facing)).append(", ");
|
builder.append(" (").append(getCameraFacingName(facing)).append(", ");
|
||||||
|
|
||||||
Rect activeSize = characteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);
|
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
|
// 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);
|
||||||
SortedSet<Integer> uniqueLowFps = getUniqueSet(lowFpsRanges);
|
SortedSet<Integer> uniqueLowFps = getUniqueSet(lowFpsRanges);
|
||||||
builder.append("fps=").append(uniqueLowFps).append(')');
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.append(')');
|
||||||
|
|
||||||
int[] capabilities = characteristics.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
|
int[] capabilities = characteristics.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
|
||||||
if (Arrays.asList(capabilities).contains(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA)) {
|
if (Arrays.asList(capabilities).contains(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA)) {
|
||||||
|
|
Loading…
Reference in a new issue