From 67adaf5ebf4fd2cafc64fa5821246cc5a57d331c Mon Sep 17 00:00:00 2001 From: Umang Jain Date: Thu, 23 Sep 2021 14:07:47 +0530 Subject: android: camera_capabilities: Clarify CameraMetadata allocation CameraMetadata's constructor take in number of entries and number of bytes to be allocated for those entries. However, CameraMetadata is already capable of resizing its container on the fly, in case more entries are added to it. Hence, the numbers passed in during the construction acts as hint values for initialization. Clarify this in CameraCapabilities::requestTemplatePreview() and remove the \todo, as the arguments and the \todo gives the perspective that we need to be quite accurate with the numbers of entries / bytes, which is not the case. Signed-off-by: Umang Jain Reviewed-by: Paul Elder Reviewed-by: Hirokazu Honda --- src/android/camera_capabilities.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/android') diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index e92bca42..edeb6943 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -1340,8 +1340,12 @@ std::unique_ptr CameraCapabilities::requestTemplateManual() cons std::unique_ptr CameraCapabilities::requestTemplatePreview() const { /* - * \todo Keep this in sync with the actual number of entries. - * Currently: 20 entries, 35 bytes + * Give initial hint of entries and number of bytes to be allocated. + * It is deliberate that the hint is slightly larger than required, to + * avoid resizing the container. + * + * CameraMetadata is capable of resizing the container on the fly, if + * adding a new entry will exceed its capacity. */ auto requestTemplate = std::make_unique(21, 36); if (!requestTemplate->isValid()) { -- cgit v1.2.1