Camera API1: relax the fps check with some margin
Some HALs may advertise slightly larger min frame durations, which
makes the supported fps check fail. Then, some supported fps range
may be missing in the supported preview fps range list.
Bug: 32544699
Change-Id: I1ed62b97d3d39e5d7f0e7c407c6cc482b8968373
diff --git a/services/camera/libcameraservice/api1/client2/Parameters.cpp b/services/camera/libcameraservice/api1/client2/Parameters.cpp
index 8ce84ae..a19fe1d 100644
--- a/services/camera/libcameraservice/api1/client2/Parameters.cpp
+++ b/services/camera/libcameraservice/api1/client2/Parameters.cpp
@@ -2900,6 +2900,7 @@
}
// Get min frame duration for each size and check if the given fps range can be supported.
+ const int32_t FPS_MARGIN = 1;
for (size_t i = 0 ; i < sizes.size(); i++) {
int64_t minFrameDuration = getMinFrameDurationNs(sizes[i], format);
if (minFrameDuration <= 0) {
@@ -2908,6 +2909,8 @@
return false;
}
int32_t maxSupportedFps = 1e9 / minFrameDuration;
+ // Add some margin here for the case where the hal supports 29.xxxfps.
+ maxSupportedFps += FPS_MARGIN;
if (fps > maxSupportedFps) {
return false;
}