From ece71b2f22195fc8c21f1237eacd81e17dc556ad Mon Sep 17 00:00:00 2001 From: Jayant Chowdhary Date: Wed, 20 Feb 2019 16:50:51 -0800 Subject: [PATCH] camera2 vndk: Clarify documentation around ACameraDevice::allocateCaptureRequest. Test: builds; not a functional change. Change-Id: Id3cc9013802eca044c24d910e4fce4fc7a640f2d Signed-off-by: Jayant Chowdhary --- camera/ndk/ndk_vendor/impl/ACameraDevice.cpp | 2 +- camera/ndk/ndk_vendor/impl/ACameraDevice.h | 7 ++++++- camera/ndk/ndk_vendor/impl/ACameraDeviceVendor.inc | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/camera/ndk/ndk_vendor/impl/ACameraDevice.cpp b/camera/ndk/ndk_vendor/impl/ACameraDevice.cpp index f7863a5eb6..9aafcd3913 100644 --- a/camera/ndk/ndk_vendor/impl/ACameraDevice.cpp +++ b/camera/ndk/ndk_vendor/impl/ACameraDevice.cpp @@ -289,7 +289,7 @@ camera_status_t CameraDevice::updateOutputConfigurationLocked(ACaptureSessionOut } camera_status_t -CameraDevice::allocateCaptureRequest( +CameraDevice::allocateCaptureRequestLocked( const ACaptureRequest* request, /*out*/sp &outReq) { sp req(new CaptureRequest()); req->mCaptureRequest.physicalCameraSettings.resize(1); diff --git a/camera/ndk/ndk_vendor/impl/ACameraDevice.h b/camera/ndk/ndk_vendor/impl/ACameraDevice.h index c63b97fc0c..d5715854e9 100644 --- a/camera/ndk/ndk_vendor/impl/ACameraDevice.h +++ b/camera/ndk/ndk_vendor/impl/ACameraDevice.h @@ -169,7 +169,12 @@ class CameraDevice final : public RefBase { camera_status_t updateOutputConfigurationLocked(ACaptureSessionOutput *output); - camera_status_t allocateCaptureRequest( + // Since this writes to ICameraDeviceUser's fmq, clients must take care that: + // a) This function is called serially. + // b) This function is called in accordance with ICameraDeviceUser.submitRequestList, + // otherwise, the wrong capture request might have the wrong settings + // metadata associated with it. + camera_status_t allocateCaptureRequestLocked( const ACaptureRequest* request, sp& outReq); static ACaptureRequest* allocateACaptureRequest(sp& req); diff --git a/camera/ndk/ndk_vendor/impl/ACameraDeviceVendor.inc b/camera/ndk/ndk_vendor/impl/ACameraDeviceVendor.inc index 7d2304e63e..8bd5a5227d 100644 --- a/camera/ndk/ndk_vendor/impl/ACameraDeviceVendor.inc +++ b/camera/ndk/ndk_vendor/impl/ACameraDeviceVendor.inc @@ -73,7 +73,7 @@ camera_status_t CameraDevice::submitRequestsLocked( requestsV.setCapacity(numRequests); for (int i = 0; i < numRequests; i++) { sp req; - ret = allocateCaptureRequest(requests[i], req); + ret = allocateCaptureRequestLocked(requests[i], req); // We need to call this method since after submitRequestList is called, // the request metadata queue might have removed the capture request // metadata. Therefore we simply add the metadata to its wrapper class,