[libcamera-devel] [PATCH 9/9] android: Elevate min duration to 30 FPS if it's lower within 2%
Han-Lin Chen
hanlinchen at chromium.org
Wed Feb 9 08:19:17 CET 2022
It's notice that Chrome Camera App filters out the resolutions which cannot
achieve 30 FPS. Elevate the minimum frame duration to 30 FPS if FPS is lower
within 2%.
Signed-off-by: Han-Lin Chen <hanlinchen at chromium.org>
---
src/android/camera_capabilities.cpp | 31 +++++++++++++++++++----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
index 55d651f3..e10ab036 100644
--- a/src/android/camera_capabilities.cpp
+++ b/src/android/camera_capabilities.cpp
@@ -655,7 +655,9 @@ int CameraCapabilities::initializeStreamConfigurations()
int64_t maxFrameDuration = frameDurations->second.max().get<int64_t>() * 1000;
/*
- * Cap min frame duration to 30 FPS with 1% tolerance.
+ * Cap min frame duration to 30 FPS with 1% tolerance,
+ * and elevate min frame duration to 30 FPS with 2%
+ * tolerance.
*
* 30 frames per second has been validated as the most
* opportune frame rate for quality tuning, and power
@@ -675,17 +677,24 @@ int CameraCapabilities::initializeStreamConfigurations()
* to the in-development configuration API rework.
*/
int64_t minFrameDurationCap = 1e9 / 30.0;
- if (minFrameDuration < minFrameDurationCap) {
- float tolerance =
- (minFrameDurationCap - minFrameDuration) * 100.0 / minFrameDurationCap;
+ float tolerance =
+ (minFrameDurationCap - minFrameDuration) * 100.0 / minFrameDurationCap;
- /*
- * If the tolerance is less than 1%, do not cap
- * the frame duration.
- */
- if (tolerance > 1.0)
- minFrameDuration = minFrameDurationCap;
- }
+ /*
+ * If the tolerance is less than 1%, do not cap
+ * the frame duration.
+ */
+ if (tolerance > 1.0)
+ minFrameDuration = minFrameDurationCap;
+
+ /*
+ * Some applications, ex: Chrome Camera App filters out
+ * the resolutions which cannot achieve 30 FPS. Elevate
+ * the minimum frame duration to 30 FPS if FPS is lower
+ * within 2%.
+ */
+ if (tolerance < 0 && tolerance > -2.0)
+ minFrameDuration = minFrameDurationCap;
streamConfigurations_.push_back({
res, androidFormat, minFrameDuration, maxFrameDuration,
--
2.35.0.263.gb82422642f-goog
More information about the libcamera-devel
mailing list