From f78f714b4486dbfd62bd62d7a479abc1d98d7495 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Sat, 3 Jul 2021 14:51:07 +0200 Subject: android: Filter preview streams on FPS Register as preview streams only streams capable of producing at least 30 FPS. This requirement comes from inspecting the existing HAL implementation on Intel IPU3 platform and from inspecting the CTS RecordingTests results. Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder Reviewed-by: Umang Jain Reviewed-by: Laurent Pinchart --- src/android/camera_capabilities.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src') diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index 43ef2ee6..bf82bbf7 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -1279,6 +1279,23 @@ int CameraCapabilities::initializeStaticMetadata() std::vector availableStreamConfigurations; availableStreamConfigurations.reserve(streamConfigurations_.size() * 4); for (const auto &entry : streamConfigurations_) { + /* + * Filter out YUV streams not capable of running at 30 FPS. + * + * This requirement comes from CTS RecordingTest failures most + * probably related to a requirement of the camcoder video + * recording profile. Inspecting the Intel IPU3 HAL + * implementation confirms this but no reference has been found + * in the metadata documentation. + * + * Calculate FPS as CTS does: see + * Camera2SurfaceViewTestCase.java:getSuitableFpsRangeForDuration() + */ + unsigned int fps = static_cast + (floor(1e9 / entry.minFrameDurationNsec + 0.05f)); + if (entry.androidFormat != HAL_PIXEL_FORMAT_BLOB && fps < 30) + continue; + availableStreamConfigurations.push_back(entry.androidFormat); availableStreamConfigurations.push_back(entry.resolution.width); availableStreamConfigurations.push_back(entry.resolution.height); @@ -1291,6 +1308,11 @@ int CameraCapabilities::initializeStaticMetadata() std::vector minFrameDurations; minFrameDurations.reserve(streamConfigurations_.size() * 4); for (const auto &entry : streamConfigurations_) { + unsigned int fps = static_cast + (floor(1e9 / entry.minFrameDurationNsec + 0.05f)); + if (entry.androidFormat != HAL_PIXEL_FORMAT_BLOB && fps < 30) + continue; + minFrameDurations.push_back(entry.androidFormat); minFrameDurations.push_back(entry.resolution.width); minFrameDurations.push_back(entry.resolution.height); -- cgit v1.2.1