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 <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
This commit is contained in:
Umang Jain 2021-09-23 14:07:47 +05:30
parent 11e9d19288
commit 67adaf5ebf

View file

@ -1340,8 +1340,12 @@ std::unique_ptr<CameraMetadata> CameraCapabilities::requestTemplateManual() cons
std::unique_ptr<CameraMetadata> 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<CameraMetadata>(21, 36);
if (!requestTemplate->isValid()) {