android: camera_metadata: Add functions for instrumenting resizing

Add utility functions to CameraMetadata to check if it has been resized,
and for outputting the actual entry and data count. This is meant to be
used to output information on resizing, to assist developers in
choosing proper initial sizes to avoid resizing. Also make CameraDevice
use these functions for static and result metadata.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
This commit is contained in:
Paul Elder 2021-05-14 18:25:47 +09:00
parent 2a84728dab
commit 9b006872cd
3 changed files with 31 additions and 1 deletions

View file

@ -1438,6 +1438,13 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
return nullptr;
}
if (staticMetadata_->resized()) {
auto [entryCount, dataCount] = staticMetadata_->usage();
LOG(HAL, Info)
<< "Static metadata resized: " << entryCount
<< " entries and " << dataCount << " bytes used";
}
return staticMetadata_->get();
}
@ -2316,5 +2323,12 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons
LOG(HAL, Error) << "Failed to construct result metadata";
}
if (resultMetadata->resized()) {
auto [entryCount, dataCount] = resultMetadata->usage();
LOG(HAL, Info)
<< "Result metadata resized: " << entryCount
<< " entries and " << dataCount << " bytes used";
}
return resultMetadata;
}