blob: 1bd0b85e7521b27be7c6ea418492a5b7747833dd [file] [log] [blame]
Emilian Peev538c90e2018-12-17 18:03:19 +00001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define LOG_TAG "Camera3-DepthCompositeStream"
18#define ATRACE_TAG ATRACE_TAG_CAMERA
19//#define LOG_NDEBUG 0
20
Jayant Chowdharyc67af1b2022-04-07 18:05:04 +000021#include <aidl/android/hardware/camera/device/CameraBlob.h>
22#include <aidl/android/hardware/camera/device/CameraBlobId.h>
Austin Borger0fb3ad92023-06-01 16:51:35 -070023#include <camera/StringUtils.h>
Jayant Chowdharyc67af1b2022-04-07 18:05:04 +000024
Emilian Peev538c90e2018-12-17 18:03:19 +000025#include "api1/client2/JpegProcessor.h"
26#include "common/CameraProviderManager.h"
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -080027#include "utils/SessionConfigurationUtils.h"
Emilian Peev538c90e2018-12-17 18:03:19 +000028#include <gui/Surface.h>
29#include <utils/Log.h>
30#include <utils/Trace.h>
31
32#include "DepthCompositeStream.h"
33
Emilian Peev538c90e2018-12-17 18:03:19 +000034namespace android {
35namespace camera3 {
36
Jayant Chowdharyc67af1b2022-04-07 18:05:04 +000037using aidl::android::hardware::camera::device::CameraBlob;
38using aidl::android::hardware::camera::device::CameraBlobId;
39
Shuzhen Wange8675782019-12-05 09:12:14 -080040DepthCompositeStream::DepthCompositeStream(sp<CameraDeviceBase> device,
Emilian Peev538c90e2018-12-17 18:03:19 +000041 wp<hardware::camera2::ICameraDeviceCallbacks> cb) :
42 CompositeStream(device, cb),
43 mBlobStreamId(-1),
44 mBlobSurfaceId(-1),
45 mDepthStreamId(-1),
46 mDepthSurfaceId(-1),
47 mBlobWidth(0),
48 mBlobHeight(0),
49 mDepthBufferAcquired(false),
50 mBlobBufferAcquired(false),
51 mProducerListener(new ProducerListener()),
Jayant Chowdharycd3d36b2021-07-10 10:53:53 -070052 mMaxJpegBufferSize(-1),
53 mUHRMaxJpegBufferSize(-1),
Emilian Peev29e9ec12020-01-02 12:43:50 -080054 mIsLogicalCamera(false) {
Shuzhen Wange8675782019-12-05 09:12:14 -080055 if (device != nullptr) {
56 CameraMetadata staticInfo = device->info();
Emilian Peev538c90e2018-12-17 18:03:19 +000057 auto entry = staticInfo.find(ANDROID_JPEG_MAX_SIZE);
58 if (entry.count > 0) {
Jayant Chowdharycd3d36b2021-07-10 10:53:53 -070059 mMaxJpegBufferSize = entry.data.i32[0];
Emilian Peev538c90e2018-12-17 18:03:19 +000060 } else {
61 ALOGW("%s: Maximum jpeg size absent from camera characteristics", __FUNCTION__);
62 }
63
Jayant Chowdharycd3d36b2021-07-10 10:53:53 -070064 mUHRMaxJpegSize =
65 SessionConfigurationUtils::getMaxJpegResolution(staticInfo,
66 /*ultraHighResolution*/true);
67 mDefaultMaxJpegSize =
68 SessionConfigurationUtils::getMaxJpegResolution(staticInfo,
69 /*isUltraHighResolution*/false);
70
71 mUHRMaxJpegBufferSize =
72 SessionConfigurationUtils::getUHRMaxJpegBufferSize(mUHRMaxJpegSize, mDefaultMaxJpegSize,
73 mMaxJpegBufferSize);
74
Emilian Peev538c90e2018-12-17 18:03:19 +000075 entry = staticInfo.find(ANDROID_LENS_INTRINSIC_CALIBRATION);
76 if (entry.count == 5) {
Emilian Peev94c98022019-06-19 09:11:51 -070077 mIntrinsicCalibration.reserve(5);
78 mIntrinsicCalibration.insert(mIntrinsicCalibration.end(), entry.data.f,
Emilian Peev538c90e2018-12-17 18:03:19 +000079 entry.data.f + 5);
80 } else {
81 ALOGW("%s: Intrinsic calibration absent from camera characteristics!", __FUNCTION__);
82 }
83
84 entry = staticInfo.find(ANDROID_LENS_DISTORTION);
85 if (entry.count == 5) {
86 mLensDistortion.reserve(5);
87 mLensDistortion.insert(mLensDistortion.end(), entry.data.f, entry.data.f + 5);
88 } else {
89 ALOGW("%s: Lens distortion absent from camera characteristics!", __FUNCTION__);
90 }
91
92 entry = staticInfo.find(ANDROID_REQUEST_AVAILABLE_CAPABILITIES);
93 for (size_t i = 0; i < entry.count; ++i) {
94 uint8_t capability = entry.data.u8[i];
95 if (capability == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA) {
96 mIsLogicalCamera = true;
97 break;
98 }
99 }
100
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800101 getSupportedDepthSizes(staticInfo, /*maxResolution*/false, &mSupportedDepthSizes);
Jayant Chowdharydbd1efb2023-02-07 16:14:48 -0800102 if (SessionConfigurationUtils::supportsUltraHighResolutionCapture(staticInfo)) {
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800103 getSupportedDepthSizes(staticInfo, true, &mSupportedDepthSizesMaximumResolution);
104 }
Emilian Peev538c90e2018-12-17 18:03:19 +0000105 }
106}
107
108DepthCompositeStream::~DepthCompositeStream() {
109 mBlobConsumer.clear(),
110 mBlobSurface.clear(),
111 mBlobStreamId = -1;
112 mBlobSurfaceId = -1;
113 mDepthConsumer.clear();
114 mDepthSurface.clear();
115 mDepthConsumer = nullptr;
116 mDepthSurface = nullptr;
117}
118
119void DepthCompositeStream::compilePendingInputLocked() {
120 CpuConsumer::LockedBuffer imgBuffer;
121
122 while (!mInputJpegBuffers.empty() && !mBlobBufferAcquired) {
123 auto it = mInputJpegBuffers.begin();
124 auto res = mBlobConsumer->lockNextBuffer(&imgBuffer);
125 if (res == NOT_ENOUGH_DATA) {
126 // Can not lock any more buffers.
127 break;
128 } else if (res != OK) {
129 ALOGE("%s: Error locking blob image buffer: %s (%d)", __FUNCTION__,
130 strerror(-res), res);
131 mPendingInputFrames[*it].error = true;
Greg Kaiser07095df2019-01-29 06:28:58 -0800132 mInputJpegBuffers.erase(it);
Emilian Peev538c90e2018-12-17 18:03:19 +0000133 continue;
134 }
135
136 if (*it != imgBuffer.timestamp) {
137 ALOGW("%s: Expecting jpeg buffer with time stamp: %" PRId64 " received buffer with "
138 "time stamp: %" PRId64, __FUNCTION__, *it, imgBuffer.timestamp);
139 }
140
141 if ((mPendingInputFrames.find(imgBuffer.timestamp) != mPendingInputFrames.end()) &&
142 (mPendingInputFrames[imgBuffer.timestamp].error)) {
143 mBlobConsumer->unlockBuffer(imgBuffer);
144 } else {
145 mPendingInputFrames[imgBuffer.timestamp].jpegBuffer = imgBuffer;
146 mBlobBufferAcquired = true;
147 }
148 mInputJpegBuffers.erase(it);
149 }
150
151 while (!mInputDepthBuffers.empty() && !mDepthBufferAcquired) {
152 auto it = mInputDepthBuffers.begin();
153 auto res = mDepthConsumer->lockNextBuffer(&imgBuffer);
154 if (res == NOT_ENOUGH_DATA) {
155 // Can not lock any more buffers.
156 break;
157 } else if (res != OK) {
158 ALOGE("%s: Error receiving depth image buffer: %s (%d)", __FUNCTION__,
159 strerror(-res), res);
160 mPendingInputFrames[*it].error = true;
161 mInputDepthBuffers.erase(it);
162 continue;
163 }
164
165 if (*it != imgBuffer.timestamp) {
166 ALOGW("%s: Expecting depth buffer with time stamp: %" PRId64 " received buffer with "
167 "time stamp: %" PRId64, __FUNCTION__, *it, imgBuffer.timestamp);
168 }
169
170 if ((mPendingInputFrames.find(imgBuffer.timestamp) != mPendingInputFrames.end()) &&
171 (mPendingInputFrames[imgBuffer.timestamp].error)) {
172 mDepthConsumer->unlockBuffer(imgBuffer);
173 } else {
174 mPendingInputFrames[imgBuffer.timestamp].depthBuffer = imgBuffer;
175 mDepthBufferAcquired = true;
176 }
177 mInputDepthBuffers.erase(it);
178 }
179
180 while (!mCaptureResults.empty()) {
181 auto it = mCaptureResults.begin();
182 // Negative timestamp indicates that something went wrong during the capture result
183 // collection process.
184 if (it->first >= 0) {
185 mPendingInputFrames[it->first].frameNumber = std::get<0>(it->second);
186 mPendingInputFrames[it->first].result = std::get<1>(it->second);
187 }
188 mCaptureResults.erase(it);
189 }
190
191 while (!mFrameNumberMap.empty()) {
192 auto it = mFrameNumberMap.begin();
193 mPendingInputFrames[it->second].frameNumber = it->first;
194 mFrameNumberMap.erase(it);
195 }
196
197 auto it = mErrorFrameNumbers.begin();
198 while (it != mErrorFrameNumbers.end()) {
199 bool frameFound = false;
200 for (auto &inputFrame : mPendingInputFrames) {
201 if (inputFrame.second.frameNumber == *it) {
202 inputFrame.second.error = true;
203 frameFound = true;
204 break;
205 }
206 }
207
208 if (frameFound) {
209 it = mErrorFrameNumbers.erase(it);
210 } else {
211 ALOGW("%s: Not able to find failing input with frame number: %" PRId64, __FUNCTION__,
212 *it);
213 it++;
214 }
215 }
216}
217
218bool DepthCompositeStream::getNextReadyInputLocked(int64_t *currentTs /*inout*/) {
219 if (currentTs == nullptr) {
220 return false;
221 }
222
223 bool newInputAvailable = false;
224 for (const auto& it : mPendingInputFrames) {
225 if ((!it.second.error) && (it.second.depthBuffer.data != nullptr) &&
226 (it.second.jpegBuffer.data != nullptr) && (it.first < *currentTs)) {
227 *currentTs = it.first;
228 newInputAvailable = true;
229 }
230 }
231
232 return newInputAvailable;
233}
234
235int64_t DepthCompositeStream::getNextFailingInputLocked(int64_t *currentTs /*inout*/) {
236 int64_t ret = -1;
237 if (currentTs == nullptr) {
238 return ret;
239 }
240
241 for (const auto& it : mPendingInputFrames) {
242 if (it.second.error && !it.second.errorNotified && (it.first < *currentTs)) {
243 *currentTs = it.first;
244 ret = it.second.frameNumber;
245 }
246 }
247
248 return ret;
249}
250
Emilian Peev90a839f2019-10-02 15:12:50 -0700251status_t DepthCompositeStream::processInputFrame(nsecs_t ts, const InputFrame &inputFrame) {
Emilian Peev538c90e2018-12-17 18:03:19 +0000252 status_t res;
253 sp<ANativeWindow> outputANW = mOutputSurface;
254 ANativeWindowBuffer *anb;
255 int fenceFd;
256 void *dstBuffer;
Emilian Peev538c90e2018-12-17 18:03:19 +0000257
258 auto jpegSize = android::camera2::JpegProcessor::findJpegSize(inputFrame.jpegBuffer.data,
259 inputFrame.jpegBuffer.width);
260 if (jpegSize == 0) {
261 ALOGW("%s: Failed to find input jpeg size, default to using entire buffer!", __FUNCTION__);
262 jpegSize = inputFrame.jpegBuffer.width;
263 }
264
Jayant Chowdharycd3d36b2021-07-10 10:53:53 -0700265 size_t maxDepthJpegBufferSize = 0;
266 if (mMaxJpegBufferSize > 0) {
267 // If this is an ultra high resolution sensor and the input frames size
268 // is > default res jpeg.
269 if (mUHRMaxJpegSize.width != 0 &&
270 inputFrame.jpegBuffer.width * inputFrame.jpegBuffer.height >
271 mDefaultMaxJpegSize.width * mDefaultMaxJpegSize.height) {
272 maxDepthJpegBufferSize = mUHRMaxJpegBufferSize;
273 } else {
274 maxDepthJpegBufferSize = mMaxJpegBufferSize;
275 }
Emilian Peev538c90e2018-12-17 18:03:19 +0000276 } else {
Jayant Chowdharycd3d36b2021-07-10 10:53:53 -0700277 maxDepthJpegBufferSize = std::max<size_t> (jpegSize,
Emilian Peev538c90e2018-12-17 18:03:19 +0000278 inputFrame.depthBuffer.width * inputFrame.depthBuffer.height * 3 / 2);
279 }
Jayant Chowdharycd3d36b2021-07-10 10:53:53 -0700280
Emilian Peev538c90e2018-12-17 18:03:19 +0000281 uint8_t jpegQuality = 100;
282 auto entry = inputFrame.result.find(ANDROID_JPEG_QUALITY);
283 if (entry.count > 0) {
284 jpegQuality = entry.data.u8[0];
285 }
Emilian Peev538c90e2018-12-17 18:03:19 +0000286
Emilian Peevcbf174b2019-01-25 14:38:59 -0800287 // The final depth photo will consist of the main jpeg buffer, the depth map buffer (also in
288 // jpeg format) and confidence map (jpeg as well). Assume worst case that all 3 jpeg need
289 // max jpeg size.
Jayant Chowdharycd3d36b2021-07-10 10:53:53 -0700290 size_t finalJpegBufferSize = maxDepthJpegBufferSize * 3;
Emilian Peev538c90e2018-12-17 18:03:19 +0000291
Emilian Peevcbf174b2019-01-25 14:38:59 -0800292 if ((res = native_window_set_buffers_dimensions(mOutputSurface.get(), finalJpegBufferSize, 1))
Emilian Peev538c90e2018-12-17 18:03:19 +0000293 != OK) {
294 ALOGE("%s: Unable to configure stream buffer dimensions"
Emilian Peevcbf174b2019-01-25 14:38:59 -0800295 " %zux%u for stream %d", __FUNCTION__, finalJpegBufferSize, 1U, mBlobStreamId);
Emilian Peev538c90e2018-12-17 18:03:19 +0000296 return res;
297 }
298
299 res = outputANW->dequeueBuffer(mOutputSurface.get(), &anb, &fenceFd);
300 if (res != OK) {
301 ALOGE("%s: Error retrieving output buffer: %s (%d)", __FUNCTION__, strerror(-res),
302 res);
303 return res;
304 }
305
306 sp<GraphicBuffer> gb = GraphicBuffer::from(anb);
Shuzhen Wangc87315d2022-03-17 00:11:20 +0000307 GraphicBufferLocker gbLocker(gb);
308 res = gbLocker.lockAsync(&dstBuffer, fenceFd);
Emilian Peev538c90e2018-12-17 18:03:19 +0000309 if (res != OK) {
310 ALOGE("%s: Error trying to lock output buffer fence: %s (%d)", __FUNCTION__,
311 strerror(-res), res);
312 outputANW->cancelBuffer(mOutputSurface.get(), anb, /*fence*/ -1);
313 return res;
314 }
315
Emilian Peevcbf174b2019-01-25 14:38:59 -0800316 if ((gb->getWidth() < finalJpegBufferSize) || (gb->getHeight() != 1)) {
Emilian Peev538c90e2018-12-17 18:03:19 +0000317 ALOGE("%s: Blob buffer size mismatch, expected %dx%d received %zux%u", __FUNCTION__,
Emilian Peevcbf174b2019-01-25 14:38:59 -0800318 gb->getWidth(), gb->getHeight(), finalJpegBufferSize, 1U);
Emilian Peev538c90e2018-12-17 18:03:19 +0000319 outputANW->cancelBuffer(mOutputSurface.get(), anb, /*fence*/ -1);
320 return BAD_VALUE;
321 }
322
Emilian Peevcbf174b2019-01-25 14:38:59 -0800323 DepthPhotoInputFrame depthPhoto;
324 depthPhoto.mMainJpegBuffer = reinterpret_cast<const char*> (inputFrame.jpegBuffer.data);
325 depthPhoto.mMainJpegWidth = mBlobWidth;
326 depthPhoto.mMainJpegHeight = mBlobHeight;
327 depthPhoto.mMainJpegSize = jpegSize;
328 depthPhoto.mDepthMapBuffer = reinterpret_cast<uint16_t*> (inputFrame.depthBuffer.data);
329 depthPhoto.mDepthMapWidth = inputFrame.depthBuffer.width;
330 depthPhoto.mDepthMapHeight = inputFrame.depthBuffer.height;
331 depthPhoto.mDepthMapStride = inputFrame.depthBuffer.stride;
332 depthPhoto.mJpegQuality = jpegQuality;
333 depthPhoto.mIsLogical = mIsLogicalCamera;
Jayant Chowdharycd3d36b2021-07-10 10:53:53 -0700334 depthPhoto.mMaxJpegSize = maxDepthJpegBufferSize;
Emilian Peevcbf174b2019-01-25 14:38:59 -0800335 // The camera intrinsic calibration layout is as follows:
336 // [focalLengthX, focalLengthY, opticalCenterX, opticalCenterY, skew]
Emilian Peev94c98022019-06-19 09:11:51 -0700337 if (mIntrinsicCalibration.size() == 5) {
338 memcpy(depthPhoto.mIntrinsicCalibration, mIntrinsicCalibration.data(),
339 sizeof(depthPhoto.mIntrinsicCalibration));
340 depthPhoto.mIsIntrinsicCalibrationValid = 1;
Emilian Peevcbf174b2019-01-25 14:38:59 -0800341 } else {
Emilian Peev94c98022019-06-19 09:11:51 -0700342 depthPhoto.mIsIntrinsicCalibrationValid = 0;
Emilian Peevcbf174b2019-01-25 14:38:59 -0800343 }
344 // The camera lens distortion contains the following lens correction coefficients.
345 // [kappa_1, kappa_2, kappa_3 kappa_4, kappa_5]
346 if (mLensDistortion.size() == 5) {
347 memcpy(depthPhoto.mLensDistortion, mLensDistortion.data(),
348 sizeof(depthPhoto.mLensDistortion));
349 depthPhoto.mIsLensDistortionValid = 1;
350 } else {
351 depthPhoto.mIsLensDistortionValid = 0;
352 }
Emilian Peev06af8c92019-02-07 12:34:41 -0800353 entry = inputFrame.result.find(ANDROID_JPEG_ORIENTATION);
354 if (entry.count > 0) {
355 // The camera jpeg orientation values must be within [0, 90, 180, 270].
356 switch (entry.data.i32[0]) {
357 case 0:
358 case 90:
359 case 180:
360 case 270:
361 depthPhoto.mOrientation = static_cast<DepthPhotoOrientation> (entry.data.i32[0]);
362 break;
363 default:
364 ALOGE("%s: Unexpected jpeg orientation value: %d, default to 0 degrees",
365 __FUNCTION__, entry.data.i32[0]);
366 }
367 }
Emilian Peevcbf174b2019-01-25 14:38:59 -0800368
369 size_t actualJpegSize = 0;
Emilian Peev29e9ec12020-01-02 12:43:50 -0800370 res = processDepthPhotoFrame(depthPhoto, finalJpegBufferSize, dstBuffer, &actualJpegSize);
Emilian Peevcbf174b2019-01-25 14:38:59 -0800371 if (res != 0) {
372 ALOGE("%s: Depth photo processing failed: %s (%d)", __FUNCTION__, strerror(-res), res);
373 outputANW->cancelBuffer(mOutputSurface.get(), anb, /*fence*/ -1);
374 return res;
375 }
376
Jayant Chowdharyc67af1b2022-04-07 18:05:04 +0000377 size_t finalJpegSize = actualJpegSize + sizeof(CameraBlob);
Emilian Peevcbf174b2019-01-25 14:38:59 -0800378 if (finalJpegSize > finalJpegBufferSize) {
379 ALOGE("%s: Final jpeg buffer not large enough for the jpeg blob header", __FUNCTION__);
380 outputANW->cancelBuffer(mOutputSurface.get(), anb, /*fence*/ -1);
381 return NO_MEMORY;
382 }
383
Emilian Peev90a839f2019-10-02 15:12:50 -0700384 res = native_window_set_buffers_timestamp(mOutputSurface.get(), ts);
385 if (res != OK) {
386 ALOGE("%s: Stream %d: Error setting timestamp: %s (%d)", __FUNCTION__,
387 getStreamId(), strerror(-res), res);
388 return res;
389 }
390
Emilian Peevcbf174b2019-01-25 14:38:59 -0800391 ALOGV("%s: Final jpeg size: %zu", __func__, finalJpegSize);
Emilian Peev538c90e2018-12-17 18:03:19 +0000392 uint8_t* header = static_cast<uint8_t *> (dstBuffer) +
Jayant Chowdharyc67af1b2022-04-07 18:05:04 +0000393 (gb->getWidth() - sizeof(CameraBlob));
394 CameraBlob *blob = reinterpret_cast<CameraBlob*> (header);
395 blob->blobId = CameraBlobId::JPEG;
396 blob->blobSizeBytes = actualJpegSize;
Emilian Peev538c90e2018-12-17 18:03:19 +0000397 outputANW->queueBuffer(mOutputSurface.get(), anb, /*fence*/ -1);
398
399 return res;
400}
401
402void DepthCompositeStream::releaseInputFrameLocked(InputFrame *inputFrame /*out*/) {
403 if (inputFrame == nullptr) {
404 return;
405 }
406
407 if (inputFrame->depthBuffer.data != nullptr) {
408 mDepthConsumer->unlockBuffer(inputFrame->depthBuffer);
409 inputFrame->depthBuffer.data = nullptr;
410 mDepthBufferAcquired = false;
411 }
412
413 if (inputFrame->jpegBuffer.data != nullptr) {
414 mBlobConsumer->unlockBuffer(inputFrame->jpegBuffer);
415 inputFrame->jpegBuffer.data = nullptr;
416 mBlobBufferAcquired = false;
417 }
418
419 if ((inputFrame->error || mErrorState) && !inputFrame->errorNotified) {
Shuzhen Wange8675782019-12-05 09:12:14 -0800420 //TODO: Figure out correct requestId
421 notifyError(inputFrame->frameNumber, -1 /*requestId*/);
Emilian Peev538c90e2018-12-17 18:03:19 +0000422 inputFrame->errorNotified = true;
423 }
424}
425
426void DepthCompositeStream::releaseInputFramesLocked(int64_t currentTs) {
427 auto it = mPendingInputFrames.begin();
428 while (it != mPendingInputFrames.end()) {
429 if (it->first <= currentTs) {
430 releaseInputFrameLocked(&it->second);
431 it = mPendingInputFrames.erase(it);
432 } else {
433 it++;
434 }
435 }
436}
437
438bool DepthCompositeStream::threadLoop() {
439 int64_t currentTs = INT64_MAX;
440 bool newInputAvailable = false;
441
442 {
443 Mutex::Autolock l(mMutex);
444
445 if (mErrorState) {
446 // In case we landed in error state, return any pending buffers and
447 // halt all further processing.
448 compilePendingInputLocked();
449 releaseInputFramesLocked(currentTs);
450 return false;
451 }
452
453 while (!newInputAvailable) {
454 compilePendingInputLocked();
455 newInputAvailable = getNextReadyInputLocked(&currentTs);
456 if (!newInputAvailable) {
457 auto failingFrameNumber = getNextFailingInputLocked(&currentTs);
458 if (failingFrameNumber >= 0) {
459 // We cannot erase 'mPendingInputFrames[currentTs]' at this point because it is
460 // possible for two internal stream buffers to fail. In such scenario the
461 // composite stream should notify the client about a stream buffer error only
462 // once and this information is kept within 'errorNotified'.
463 // Any present failed input frames will be removed on a subsequent call to
464 // 'releaseInputFramesLocked()'.
465 releaseInputFrameLocked(&mPendingInputFrames[currentTs]);
466 currentTs = INT64_MAX;
467 }
468
469 auto ret = mInputReadyCondition.waitRelative(mMutex, kWaitDuration);
470 if (ret == TIMED_OUT) {
471 return true;
472 } else if (ret != OK) {
473 ALOGE("%s: Timed wait on condition failed: %s (%d)", __FUNCTION__,
474 strerror(-ret), ret);
475 return false;
476 }
477 }
478 }
479 }
480
Emilian Peev90a839f2019-10-02 15:12:50 -0700481 auto res = processInputFrame(currentTs, mPendingInputFrames[currentTs]);
Emilian Peev538c90e2018-12-17 18:03:19 +0000482 Mutex::Autolock l(mMutex);
483 if (res != OK) {
484 ALOGE("%s: Failed processing frame with timestamp: %" PRIu64 ": %s (%d)", __FUNCTION__,
485 currentTs, strerror(-res), res);
486 mPendingInputFrames[currentTs].error = true;
487 }
488
489 releaseInputFramesLocked(currentTs);
490
491 return true;
492}
493
494bool DepthCompositeStream::isDepthCompositeStream(const sp<Surface> &surface) {
495 ANativeWindow *anw = surface.get();
496 status_t err;
497 int format;
498 if ((err = anw->query(anw, NATIVE_WINDOW_FORMAT, &format)) != OK) {
Austin Borger0fb3ad92023-06-01 16:51:35 -0700499 std::string msg = fmt::sprintf("Failed to query Surface format: %s (%d)", strerror(-err),
Emilian Peev538c90e2018-12-17 18:03:19 +0000500 err);
Austin Borger0fb3ad92023-06-01 16:51:35 -0700501 ALOGE("%s: %s", __FUNCTION__, msg.c_str());
Emilian Peev538c90e2018-12-17 18:03:19 +0000502 return false;
503 }
504
505 int dataspace;
506 if ((err = anw->query(anw, NATIVE_WINDOW_DEFAULT_DATASPACE, &dataspace)) != OK) {
Austin Borger0fb3ad92023-06-01 16:51:35 -0700507 std::string msg = fmt::sprintf("Failed to query Surface dataspace: %s (%d)", strerror(-err),
Emilian Peev538c90e2018-12-17 18:03:19 +0000508 err);
Austin Borger0fb3ad92023-06-01 16:51:35 -0700509 ALOGE("%s: %s", __FUNCTION__, msg.c_str());
Emilian Peev538c90e2018-12-17 18:03:19 +0000510 return false;
511 }
512
513 if ((format == HAL_PIXEL_FORMAT_BLOB) && (dataspace == HAL_DATASPACE_DYNAMIC_DEPTH)) {
514 return true;
515 }
516
517 return false;
518}
519
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800520static bool setContains(std::unordered_set<int32_t> containerSet, int32_t value) {
521 return containerSet.find(value) != containerSet.end();
522}
523
524status_t DepthCompositeStream::checkAndGetMatchingDepthSize(size_t width, size_t height,
525 const std::vector<std::tuple<size_t, size_t>> &depthSizes,
526 const std::vector<std::tuple<size_t, size_t>> &depthSizesMaximumResolution,
527 const std::unordered_set<int32_t> &sensorPixelModesUsed,
528 size_t *depthWidth, size_t *depthHeight) {
529 if (depthWidth == nullptr || depthHeight == nullptr) {
530 return BAD_VALUE;
531 }
532 size_t chosenDepthWidth = 0, chosenDepthHeight = 0;
533 bool hasDefaultSensorPixelMode =
534 setContains(sensorPixelModesUsed, ANDROID_SENSOR_PIXEL_MODE_DEFAULT);
535
536 bool hasMaximumResolutionSensorPixelMode =
537 setContains(sensorPixelModesUsed, ANDROID_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION);
538
539 if (!hasDefaultSensorPixelMode && !hasMaximumResolutionSensorPixelMode) {
540 ALOGE("%s: sensor pixel modes don't contain either maximum resolution or default modes",
541 __FUNCTION__);
542 return BAD_VALUE;
543 }
544
545 if (hasDefaultSensorPixelMode) {
546 auto ret = getMatchingDepthSize(width, height, depthSizes, &chosenDepthWidth,
547 &chosenDepthHeight);
548 if (ret != OK) {
549 ALOGE("%s: No matching depth stream size found", __FUNCTION__);
550 return ret;
551 }
552 }
553
554 if (hasMaximumResolutionSensorPixelMode) {
555 size_t depthWidth = 0, depthHeight = 0;
556 auto ret = getMatchingDepthSize(width, height,
557 depthSizesMaximumResolution, &depthWidth, &depthHeight);
558 if (ret != OK) {
559 ALOGE("%s: No matching max resolution depth stream size found", __FUNCTION__);
560 return ret;
561 }
562 // Both matching depth sizes should be the same.
563 if (chosenDepthWidth != 0 && chosenDepthWidth != depthWidth &&
564 chosenDepthHeight != depthHeight) {
565 ALOGE("%s: Maximum resolution sensor pixel mode and default sensor pixel mode don't"
566 " have matching depth sizes", __FUNCTION__);
567 return BAD_VALUE;
568 }
569 if (chosenDepthWidth == 0) {
570 chosenDepthWidth = depthWidth;
571 chosenDepthHeight = depthHeight;
572 }
573 }
574 *depthWidth = chosenDepthWidth;
575 *depthHeight = chosenDepthHeight;
576 return OK;
577}
578
579
Emilian Peev538c90e2018-12-17 18:03:19 +0000580status_t DepthCompositeStream::createInternalStreams(const std::vector<sp<Surface>>& consumers,
581 bool /*hasDeferredConsumer*/, uint32_t width, uint32_t height, int format,
Austin Borger0fb3ad92023-06-01 16:51:35 -0700582 camera_stream_rotation_t rotation, int *id, const std::string& physicalCameraId,
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800583 const std::unordered_set<int32_t> &sensorPixelModesUsed,
584 std::vector<int> *surfaceIds,
Emilian Peev434248e2022-10-06 14:58:54 -0700585 int /*streamSetId*/, bool /*isShared*/, int32_t /*colorSpace*/,
Shuzhen Wangbce53db2022-12-03 00:38:20 +0000586 int64_t /*dynamicProfile*/, int64_t /*streamUseCase*/, bool useReadoutTimestamp) {
Emilian Peev538c90e2018-12-17 18:03:19 +0000587 if (mSupportedDepthSizes.empty()) {
588 ALOGE("%s: This camera device doesn't support any depth map streams!", __FUNCTION__);
589 return INVALID_OPERATION;
590 }
591
592 size_t depthWidth, depthHeight;
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800593 auto ret =
594 checkAndGetMatchingDepthSize(width, height, mSupportedDepthSizes,
595 mSupportedDepthSizesMaximumResolution, sensorPixelModesUsed, &depthWidth,
596 &depthHeight);
Emilian Peev538c90e2018-12-17 18:03:19 +0000597 if (ret != OK) {
598 ALOGE("%s: Failed to find an appropriate depth stream size!", __FUNCTION__);
599 return ret;
600 }
601
602 sp<CameraDeviceBase> device = mDevice.promote();
603 if (!device.get()) {
604 ALOGE("%s: Invalid camera device!", __FUNCTION__);
605 return NO_INIT;
606 }
607
608 sp<IGraphicBufferProducer> producer;
609 sp<IGraphicBufferConsumer> consumer;
610 BufferQueue::createBufferQueue(&producer, &consumer);
611 mBlobConsumer = new CpuConsumer(consumer, /*maxLockedBuffers*/1, /*controlledByApp*/ true);
612 mBlobConsumer->setFrameAvailableListener(this);
613 mBlobConsumer->setName(String8("Camera3-JpegCompositeStream"));
614 mBlobSurface = new Surface(producer);
615
616 ret = device->createStream(mBlobSurface, width, height, format, kJpegDataSpace, rotation,
Shuzhen Wangbce53db2022-12-03 00:38:20 +0000617 id, physicalCameraId, sensorPixelModesUsed, surfaceIds,
618 camera3::CAMERA3_STREAM_SET_ID_INVALID, /*isShared*/false, /*isMultiResolution*/false,
619 /*consumerUsage*/0, ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
620 ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
621 OutputConfiguration::TIMESTAMP_BASE_DEFAULT,
622 OutputConfiguration::MIRROR_MODE_AUTO,
623 ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED,
624 useReadoutTimestamp);
Emilian Peev538c90e2018-12-17 18:03:19 +0000625 if (ret == OK) {
626 mBlobStreamId = *id;
627 mBlobSurfaceId = (*surfaceIds)[0];
628 mOutputSurface = consumers[0];
629 } else {
630 return ret;
631 }
632
633 BufferQueue::createBufferQueue(&producer, &consumer);
634 mDepthConsumer = new CpuConsumer(consumer, /*maxLockedBuffers*/ 1, /*controlledByApp*/ true);
635 mDepthConsumer->setFrameAvailableListener(this);
636 mDepthConsumer->setName(String8("Camera3-DepthCompositeStream"));
637 mDepthSurface = new Surface(producer);
638 std::vector<int> depthSurfaceId;
639 ret = device->createStream(mDepthSurface, depthWidth, depthHeight, kDepthMapPixelFormat,
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800640 kDepthMapDataSpace, rotation, &mDepthStreamId, physicalCameraId, sensorPixelModesUsed,
Shuzhen Wangbce53db2022-12-03 00:38:20 +0000641 &depthSurfaceId, camera3::CAMERA3_STREAM_SET_ID_INVALID, /*isShared*/false,
642 /*isMultiResolution*/false, /*consumerUsage*/0,
643 ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD,
644 ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT,
645 OutputConfiguration::TIMESTAMP_BASE_DEFAULT,
646 OutputConfiguration::MIRROR_MODE_AUTO,
647 ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED,
648 useReadoutTimestamp);
Emilian Peev538c90e2018-12-17 18:03:19 +0000649 if (ret == OK) {
650 mDepthSurfaceId = depthSurfaceId[0];
651 } else {
652 return ret;
653 }
654
655 ret = registerCompositeStreamListener(getStreamId());
656 if (ret != OK) {
657 ALOGE("%s: Failed to register blob stream listener!", __FUNCTION__);
658 return ret;
659 }
660
661 ret = registerCompositeStreamListener(mDepthStreamId);
662 if (ret != OK) {
663 ALOGE("%s: Failed to register depth stream listener!", __FUNCTION__);
664 return ret;
665 }
666
667 mBlobWidth = width;
668 mBlobHeight = height;
669
670 return ret;
671}
672
673status_t DepthCompositeStream::configureStream() {
674 if (isRunning()) {
675 // Processing thread is already running, nothing more to do.
676 return NO_ERROR;
677 }
678
679 if (mOutputSurface.get() == nullptr) {
680 ALOGE("%s: No valid output surface set!", __FUNCTION__);
681 return NO_INIT;
682 }
683
684 auto res = mOutputSurface->connect(NATIVE_WINDOW_API_CAMERA, mProducerListener);
685 if (res != OK) {
686 ALOGE("%s: Unable to connect to native window for stream %d",
687 __FUNCTION__, mBlobStreamId);
688 return res;
689 }
690
691 if ((res = native_window_set_buffers_format(mOutputSurface.get(), HAL_PIXEL_FORMAT_BLOB))
692 != OK) {
693 ALOGE("%s: Unable to configure stream buffer format for stream %d", __FUNCTION__,
694 mBlobStreamId);
695 return res;
696 }
697
698 int maxProducerBuffers;
699 ANativeWindow *anw = mBlobSurface.get();
700 if ((res = anw->query(anw, NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &maxProducerBuffers)) != OK) {
701 ALOGE("%s: Unable to query consumer undequeued"
702 " buffer count for stream %d", __FUNCTION__, mBlobStreamId);
703 return res;
704 }
705
706 ANativeWindow *anwConsumer = mOutputSurface.get();
707 int maxConsumerBuffers;
708 if ((res = anwConsumer->query(anwConsumer, NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS,
709 &maxConsumerBuffers)) != OK) {
710 ALOGE("%s: Unable to query consumer undequeued"
711 " buffer count for stream %d", __FUNCTION__, mBlobStreamId);
712 return res;
713 }
714
715 if ((res = native_window_set_buffer_count(
716 anwConsumer, maxProducerBuffers + maxConsumerBuffers)) != OK) {
717 ALOGE("%s: Unable to set buffer count for stream %d", __FUNCTION__, mBlobStreamId);
718 return res;
719 }
720
721 run("DepthCompositeStreamProc");
722
723 return NO_ERROR;
724}
725
726status_t DepthCompositeStream::deleteInternalStreams() {
727 // The 'CameraDeviceClient' parent will delete the blob stream
728 requestExit();
729
730 auto ret = join();
731 if (ret != OK) {
732 ALOGE("%s: Failed to join with the main processing thread: %s (%d)", __FUNCTION__,
733 strerror(-ret), ret);
734 }
735
Emilian Peev538c90e2018-12-17 18:03:19 +0000736 if (mDepthStreamId >= 0) {
Emilian Peevc0fe54c2020-03-11 14:05:07 -0700737 // Camera devices may not be valid after switching to offline mode.
738 // In this case, all offline streams including internal composite streams
739 // are managed and released by the offline session.
740 sp<CameraDeviceBase> device = mDevice.promote();
741 if (device.get() != nullptr) {
742 ret = device->deleteStream(mDepthStreamId);
743 }
744
Emilian Peev538c90e2018-12-17 18:03:19 +0000745 mDepthStreamId = -1;
746 }
747
Shuzhen Wang2c545042019-02-07 10:27:35 -0800748 if (mOutputSurface != nullptr) {
749 mOutputSurface->disconnect(NATIVE_WINDOW_API_CAMERA);
750 mOutputSurface.clear();
751 }
752
Emilian Peev538c90e2018-12-17 18:03:19 +0000753 return ret;
754}
755
756void DepthCompositeStream::onFrameAvailable(const BufferItem& item) {
757 if (item.mDataSpace == kJpegDataSpace) {
758 ALOGV("%s: Jpeg buffer with ts: %" PRIu64 " ms. arrived!",
759 __func__, ns2ms(item.mTimestamp));
760
761 Mutex::Autolock l(mMutex);
762 if (!mErrorState) {
763 mInputJpegBuffers.push_back(item.mTimestamp);
764 mInputReadyCondition.signal();
765 }
766 } else if (item.mDataSpace == kDepthMapDataSpace) {
767 ALOGV("%s: Depth buffer with ts: %" PRIu64 " ms. arrived!", __func__,
768 ns2ms(item.mTimestamp));
769
770 Mutex::Autolock l(mMutex);
771 if (!mErrorState) {
772 mInputDepthBuffers.push_back(item.mTimestamp);
773 mInputReadyCondition.signal();
774 }
775 } else {
776 ALOGE("%s: Unexpected data space: 0x%x", __FUNCTION__, item.mDataSpace);
777 }
778}
779
780status_t DepthCompositeStream::insertGbp(SurfaceMap* /*out*/outSurfaceMap,
781 Vector<int32_t> * /*out*/outputStreamIds, int32_t* /*out*/currentStreamId) {
782 if (outSurfaceMap->find(mDepthStreamId) == outSurfaceMap->end()) {
Emilian Peev538c90e2018-12-17 18:03:19 +0000783 outputStreamIds->push_back(mDepthStreamId);
784 }
785 (*outSurfaceMap)[mDepthStreamId].push_back(mDepthSurfaceId);
786
787 if (outSurfaceMap->find(mBlobStreamId) == outSurfaceMap->end()) {
Emilian Peev538c90e2018-12-17 18:03:19 +0000788 outputStreamIds->push_back(mBlobStreamId);
789 }
790 (*outSurfaceMap)[mBlobStreamId].push_back(mBlobSurfaceId);
791
792 if (currentStreamId != nullptr) {
793 *currentStreamId = mBlobStreamId;
794 }
795
796 return NO_ERROR;
797}
798
Emilian Peev4697b642019-11-19 17:11:14 -0800799status_t DepthCompositeStream::insertCompositeStreamIds(
800 std::vector<int32_t>* compositeStreamIds /*out*/) {
801 if (compositeStreamIds == nullptr) {
802 return BAD_VALUE;
803 }
804
805 compositeStreamIds->push_back(mDepthStreamId);
806 compositeStreamIds->push_back(mBlobStreamId);
807
808 return OK;
809}
810
Emilian Peev538c90e2018-12-17 18:03:19 +0000811void DepthCompositeStream::onResultError(const CaptureResultExtras& resultExtras) {
812 // Processing can continue even in case of result errors.
813 // At the moment depth composite stream processing relies mainly on static camera
814 // characteristics data. The actual result data can be used for the jpeg quality but
815 // in case it is absent we can default to maximum.
816 eraseResult(resultExtras.frameNumber);
817}
818
819bool DepthCompositeStream::onStreamBufferError(const CaptureResultExtras& resultExtras) {
820 bool ret = false;
821 // Buffer errors concerning internal composite streams should not be directly visible to
822 // camera clients. They must only receive a single buffer error with the public composite
823 // stream id.
824 if ((resultExtras.errorStreamId == mDepthStreamId) ||
825 (resultExtras.errorStreamId == mBlobStreamId)) {
826 flagAnErrorFrameNumber(resultExtras.frameNumber);
827 ret = true;
828 }
829
830 return ret;
831}
832
833status_t DepthCompositeStream::getMatchingDepthSize(size_t width, size_t height,
834 const std::vector<std::tuple<size_t, size_t>>& supporedDepthSizes,
835 size_t *depthWidth /*out*/, size_t *depthHeight /*out*/) {
836 if ((depthWidth == nullptr) || (depthHeight == nullptr)) {
837 return BAD_VALUE;
838 }
839
840 float arTol = CameraProviderManager::kDepthARTolerance;
841 *depthWidth = *depthHeight = 0;
842
843 float aspectRatio = static_cast<float> (width) / static_cast<float> (height);
844 for (const auto& it : supporedDepthSizes) {
845 auto currentWidth = std::get<0>(it);
846 auto currentHeight = std::get<1>(it);
847 if ((currentWidth == width) && (currentHeight == height)) {
848 *depthWidth = width;
849 *depthHeight = height;
850 break;
851 } else {
852 float currentRatio = static_cast<float> (currentWidth) /
853 static_cast<float> (currentHeight);
854 auto currentSize = currentWidth * currentHeight;
855 auto oldSize = (*depthWidth) * (*depthHeight);
856 if ((fabs(aspectRatio - currentRatio) <= arTol) && (currentSize > oldSize)) {
857 *depthWidth = currentWidth;
858 *depthHeight = currentHeight;
859 }
860 }
861 }
862
863 return ((*depthWidth > 0) && (*depthHeight > 0)) ? OK : BAD_VALUE;
864}
865
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800866void DepthCompositeStream::getSupportedDepthSizes(const CameraMetadata& ch, bool maxResolution,
Emilian Peev538c90e2018-12-17 18:03:19 +0000867 std::vector<std::tuple<size_t, size_t>>* depthSizes /*out*/) {
868 if (depthSizes == nullptr) {
869 return;
870 }
871
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800872 auto entry = ch.find(
873 camera3::SessionConfigurationUtils::getAppropriateModeTag(
874 ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS, maxResolution));
Emilian Peev538c90e2018-12-17 18:03:19 +0000875 if (entry.count > 0) {
876 // Depth stream dimensions have four int32_t components
877 // (pixelformat, width, height, type)
878 size_t entryCount = entry.count / 4;
879 depthSizes->reserve(entryCount);
880 for (size_t i = 0; i < entry.count; i += 4) {
881 if ((entry.data.i32[i] == kDepthMapPixelFormat) &&
882 (entry.data.i32[i+3] ==
883 ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT)) {
884 depthSizes->push_back(std::make_tuple(entry.data.i32[i+1],
885 entry.data.i32[i+2]));
886 }
887 }
888 }
889}
890
891status_t DepthCompositeStream::getCompositeStreamInfo(const OutputStreamInfo &streamInfo,
892 const CameraMetadata& ch, std::vector<OutputStreamInfo>* compositeOutput /*out*/) {
893 if (compositeOutput == nullptr) {
894 return BAD_VALUE;
895 }
896
897 std::vector<std::tuple<size_t, size_t>> depthSizes;
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800898 std::vector<std::tuple<size_t, size_t>> depthSizesMaximumResolution;
899 getSupportedDepthSizes(ch, /*maxResolution*/false, &depthSizes);
Emilian Peev538c90e2018-12-17 18:03:19 +0000900 if (depthSizes.empty()) {
901 ALOGE("%s: No depth stream configurations present", __FUNCTION__);
902 return BAD_VALUE;
903 }
904
Jayant Chowdharydbd1efb2023-02-07 16:14:48 -0800905 if (SessionConfigurationUtils::supportsUltraHighResolutionCapture(ch)) {
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800906 getSupportedDepthSizes(ch, /*maxResolution*/true, &depthSizesMaximumResolution);
907 if (depthSizesMaximumResolution.empty()) {
908 ALOGE("%s: No depth stream configurations for maximum resolution present",
909 __FUNCTION__);
910 return BAD_VALUE;
911 }
912 }
913
914 size_t chosenDepthWidth = 0, chosenDepthHeight = 0;
915 auto ret = checkAndGetMatchingDepthSize(streamInfo.width, streamInfo.height, depthSizes,
916 depthSizesMaximumResolution, streamInfo.sensorPixelModesUsed, &chosenDepthWidth,
917 &chosenDepthHeight);
918
Emilian Peev538c90e2018-12-17 18:03:19 +0000919 if (ret != OK) {
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800920 ALOGE("%s: Couldn't get matching depth sizes", __FUNCTION__);
Emilian Peev538c90e2018-12-17 18:03:19 +0000921 return ret;
922 }
923
924 compositeOutput->clear();
925 compositeOutput->insert(compositeOutput->end(), 2, streamInfo);
926
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800927 // Sensor pixel modes should stay the same here. They're already overridden.
Emilian Peev538c90e2018-12-17 18:03:19 +0000928 // Jpeg/Blob stream info
929 (*compositeOutput)[0].dataSpace = kJpegDataSpace;
930 (*compositeOutput)[0].consumerUsage = GRALLOC_USAGE_SW_READ_OFTEN;
931
932 // Depth stream info
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800933 (*compositeOutput)[1].width = chosenDepthWidth;
934 (*compositeOutput)[1].height = chosenDepthHeight;
Emilian Peev538c90e2018-12-17 18:03:19 +0000935 (*compositeOutput)[1].format = kDepthMapPixelFormat;
936 (*compositeOutput)[1].dataSpace = kDepthMapDataSpace;
937 (*compositeOutput)[1].consumerUsage = GRALLOC_USAGE_SW_READ_OFTEN;
938
939 return NO_ERROR;
940}
941
Emilian Peev538c90e2018-12-17 18:03:19 +0000942}; // namespace camera3
943}; // namespace android