Add frame rate and sensor orientation for virtual camera
Test: atest CtsVirtualDevicesCameraTestCases
Test: atest virtual_camera_tests
Bug: 310857519
Change-Id: I0dc882f86881f5aaaa6501fdc3fd2f5d64fe2bc0
diff --git a/services/camera/virtualcamera/util/Util.cc b/services/camera/virtualcamera/util/Util.cc
index df771b1..2d0545d 100644
--- a/services/camera/virtualcamera/util/Util.cc
+++ b/services/camera/virtualcamera/util/Util.cc
@@ -35,6 +35,7 @@
// TODO(b/301023410) - Query actual max texture size.
constexpr int kMaxTextureSize = 2048;
constexpr int kLibJpegDctSize = DCTSIZE;
+constexpr int kMaxFpsUpperLimit = 60;
constexpr std::array<Format, 2> kSupportedFormats{Format::YUV_420_888,
Format::RGBA_8888};
@@ -54,7 +55,7 @@
// Returns true if specified format is supported for virtual camera input.
bool isFormatSupportedForInput(const int width, const int height,
- const Format format) {
+ const Format format, const int maxFps) {
if (!isPixelFormatSupportedForInput(format)) {
return false;
}
@@ -71,6 +72,10 @@
return false;
}
+ if (maxFps <= 0 || maxFps > kMaxFpsUpperLimit) {
+ return false;
+ }
+
return true;
}