diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-07-31 03:07:55 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-07-31 03:07:55 +0000 |
commit | 2c1ea9dc8dd91d65684ce045d1292ad3eef4eec0 (patch) | |
tree | cd524d1c44ed5ba56e86e6ff9a0fbf7505cc0160 | |
parent | d2455c3e606688a0333cb32818d7e3a09ee55a5a (diff) | |
parent | 8facf7af35ae12fb6b5eb159eccbbf3b2ca49c3c (diff) | |
download | dynamic_depth-2c1ea9dc8dd91d65684ce045d1292ad3eef4eec0.tar.gz |
Snap for 5768201 from 8facf7af35ae12fb6b5eb159eccbbf3b2ca49c3c to qt-c2f2-releaseandroid-10.0.0_r9android-10.0.0_r8android-10.0.0_r7android-10.0.0_r14android-10.0.0_r13android-10.0.0_r12android10-c2f2-s2-releaseandroid10-c2f2-s1-releaseandroid10-c2f2-release
Change-Id: I3d573c967f9e16913bfa8b2ecf8f7f85dc1a09f4
-rw-r--r-- | internal/dynamic_depth/depth_jpeg.cc | 13 |
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) { |