diff options
author | Emilian Peev <epeev@google.com> | 2019-02-04 15:50:17 -0800 |
---|---|---|
committer | Emilian Peev <epeev@google.com> | 2019-02-06 17:42:00 +0000 |
commit | 3663c2c50d146a507e222cb6c2cef32dde2b09c3 (patch) | |
tree | d518ae53afa573a8edd10e1864f84f22cbf3f404 | |
parent | 7e8ff987a6d808b25198d6ab7ebee21dd3255274 (diff) | |
download | dynamic_depth-3663c2c50d146a507e222cb6c2cef32dde2b09c3.tar.gz |
Check for depth map payload
The depth map payload presence is required
according to specification.
Bug:123316622
Test: Camera CTS
Change-Id: I4b4174246b7dc21a4d01da638a4563d85fa14317
-rw-r--r-- | README.android | 1 | ||||
-rw-r--r-- | internal/dynamic_depth/depth_jpeg.cc | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/README.android b/README.android index 00f3c0b..248e7b6 100644 --- a/README.android +++ b/README.android @@ -7,3 +7,4 @@ Local patches ------------- - Android depth photo validation sequence "ValidateAndroidDynamicDepthBuffer()". - Add NDK library variant. +- Check for depth map payload diff --git a/internal/dynamic_depth/depth_jpeg.cc b/internal/dynamic_depth/depth_jpeg.cc index ec5ab89..396a41e 100644 --- a/internal/dynamic_depth/depth_jpeg.cc +++ b/internal/dynamic_depth/depth_jpeg.cc @@ -104,6 +104,18 @@ int32_t ValidateAndroidDynamicDepthBuffer(const char* buffer, size_t buffer_leng return -1; } + std::istringstream input_jpeg_stream(std::string(buffer, buffer_length)); + std::string depth_payload; + if (!GetItemPayload(device->GetContainer(), depth_uri, input_jpeg_stream, &depth_payload)) { + LOG(ERROR) << "Unable to retrieve depth map"; + return -1; + } + + if (depth_payload.empty()) { + LOG(ERROR) << "Invalid depth map"; + return -1; + } + return 0; } |