diff options
author | Shuzhen Wang <shuzhenwang@google.com> | 2018-03-09 15:58:43 -0800 |
---|---|---|
committer | Shuzhen Wang <shuzhenwang@google.com> | 2018-03-09 16:01:06 -0800 |
commit | 17d817a889da6be3f77da83ef0b3547461b4a6a6 (patch) | |
tree | d584459e9e51318ff731a37da028a9619abd237d /camera/device/3.2/default/CameraDeviceSession.cpp | |
parent | a3819421700f9a743c8c515029cac798555946f6 (diff) |
Camera: Do not forward capture_result in error condition
If HAL calls process_capture_result with invalid buffers, the HIDL
wrapper shouldn't forward it to camera service, since the CaptureResult
structure may not be completely initialized.
Test: Run GoogleCamera
Bug: 74433802
Change-Id: Iaf20b542af5b11ffbedf709e99137b69d77a9ad3
Diffstat (limited to 'camera/device/3.2/default/CameraDeviceSession.cpp')
-rw-r--r-- | camera/device/3.2/default/CameraDeviceSession.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/camera/device/3.2/default/CameraDeviceSession.cpp b/camera/device/3.2/default/CameraDeviceSession.cpp index 975fb01347..5f89cde972 100644 --- a/camera/device/3.2/default/CameraDeviceSession.cpp +++ b/camera/device/3.2/default/CameraDeviceSession.cpp @@ -1198,7 +1198,7 @@ Return<void> CameraDeviceSession::close() { return Void(); } -void CameraDeviceSession::constructCaptureResult(CaptureResult& result, +status_t CameraDeviceSession::constructCaptureResult(CaptureResult& result, const camera3_capture_result *hal_result) { uint32_t frameNumber = hal_result->frame_number; bool hasInputBuf = (hal_result->input_buffer != nullptr); @@ -1213,7 +1213,7 @@ void CameraDeviceSession::constructCaptureResult(CaptureResult& result, if (mInflightBuffers.count(key) != 1) { ALOGE("%s: input buffer for stream %d frame %d is not inflight!", __FUNCTION__, streamId, frameNumber); - return; + return -EINVAL; } } @@ -1224,7 +1224,7 @@ void CameraDeviceSession::constructCaptureResult(CaptureResult& result, if (mInflightBuffers.count(key) != 1) { ALOGE("%s: output buffer for stream %d frame %d is not inflight!", __FUNCTION__, streamId, frameNumber); - return; + return -EINVAL; } } } @@ -1344,7 +1344,7 @@ void CameraDeviceSession::constructCaptureResult(CaptureResult& result, ALOGV("%s: inflight buffer queue is now empty!", __FUNCTION__); } } - + return OK; } /** @@ -1356,10 +1356,11 @@ void CameraDeviceSession::sProcessCaptureResult( CameraDeviceSession *d = const_cast<CameraDeviceSession*>(static_cast<const CameraDeviceSession*>(cb)); - CaptureResult result; - d->constructCaptureResult(result, hal_result); - - d->mResultBatcher.processCaptureResult(result); + CaptureResult result = {}; + status_t ret = d->constructCaptureResult(result, hal_result); + if (ret == OK) { + d->mResultBatcher.processCaptureResult(result); + } } void CameraDeviceSession::sNotify( |