summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzuWei Lin <szuweilin@google.com>2019-12-23 18:39:01 +0800
committerSzuWei Lin <szuweilin@google.com>2019-12-23 18:39:01 +0800
commit76118d15f4318492e492059217e52e37a1cebcb3 (patch)
treecd524d1c44ed5ba56e86e6ff9a0fbf7505cc0160
parentb9b6a727d692abb5fb0a13229e3a529b2b724889 (diff)
parent055cc88b552ac956f518e1904c67256d26d4b1bc (diff)
downloadplatform_external_dynamic_depth-android10-gsi.tar.gz
platform_external_dynamic_depth-android10-gsi.tar.bz2
platform_external_dynamic_depth-android10-gsi.zip
Merge branch android10-qpr1-releaseandroid10-gsi
Change-Id: I95e71ff325a75889a2a5aeb0ed502831ebdf5237
-rw-r--r--internal/dynamic_depth/depth_jpeg.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/dynamic_depth/depth_jpeg.cc b/internal/dynamic_depth/depth_jpeg.cc
index 396a41e..af2ead9 100644
--- a/internal/dynamic_depth/depth_jpeg.cc
+++ b/internal/dynamic_depth/depth_jpeg.cc
@@ -19,6 +19,7 @@ namespace dynamic_depth {
int32_t ValidateAndroidDynamicDepthBuffer(const char* buffer, size_t buffer_length) {
XmpData xmp_data;
+ std::string itemMime("image/jpeg");
const string image_data(buffer, buffer_length);
ReadXmpFromMemory(image_data, /*XmpSkipExtended*/ false, &xmp_data);
@@ -29,6 +30,18 @@ int32_t ValidateAndroidDynamicDepthBuffer(const char* buffer, size_t buffer_leng
return -1;
}
+ // Check the container items mime type
+ if ((device->GetContainer() == nullptr) || (device->GetContainer()->GetItems().empty())) {
+ LOG(ERROR) << "No container or container items found!";
+ return -1;
+ }
+ auto items = device->GetContainer()->GetItems();
+ for (const auto& item : items) {
+ if (item->GetMime() != itemMime) {
+ LOG(ERROR) << "Item MIME type doesn't match the expected value: " << itemMime;
+ return -1;
+ }
+ }
// Check profiles
const Profiles* profiles = device->GetProfiles();
if (profiles == nullptr) {