Camera: fix NDK logspam
Duration keys may be missing if the device doesn't support
corresponding capture feature.
Test: build (log only change)
Bug: 150900659
Merged-In: I83e122ff08bc581ddd4bb7e304f152f612817875
Change-Id: I83e122ff08bc581ddd4bb7e304f152f612817875
diff --git a/camera/ndk/impl/ACameraMetadata.cpp b/camera/ndk/impl/ACameraMetadata.cpp
index 1bbb9c2..446ca4f 100644
--- a/camera/ndk/impl/ACameraMetadata.cpp
+++ b/camera/ndk/impl/ACameraMetadata.cpp
@@ -139,12 +139,20 @@
const int STREAM_WIDTH_OFFSET = 1;
const int STREAM_HEIGHT_OFFSET = 2;
const int STREAM_DURATION_OFFSET = 3;
+
camera_metadata_entry entry = mData->find(tag);
- if (entry.count == 0 || entry.count % 4 || entry.type != TYPE_INT64) {
+
+ if (entry.count == 0) {
+ // Duration keys can be missing when corresponding capture feature is not supported
+ return;
+ }
+
+ if (entry.count % 4 || entry.type != TYPE_INT64) {
ALOGE("%s: malformed duration key %d! count %zu, type %d",
__FUNCTION__, tag, entry.count, entry.type);
return;
}
+
Vector<int64_t> filteredDurations;
filteredDurations.setCapacity(entry.count * 2);