diff options
author | Umang Jain <umang.jain@ideasonboard.com> | 2021-10-26 12:51:44 +0530 |
---|---|---|
committer | Umang Jain <umang.jain@ideasonboard.com> | 2021-10-26 16:11:17 +0530 |
commit | 64bcbd0e2c2ac78fae7e329cec86bc4806cd5c45 (patch) | |
tree | 073f62402ed4ae9205d673618a863b5f3443da62 /src/android/camera_device.h | |
parent | ed9eb080e9d723292596ee4d335e101b0ae75278 (diff) |
android: camera_device: Refactor descriptor status and sendCaptureResults()
Currently, we use Camera3RequestDescriptor::Status to determine:
- When the descriptor has been completely processed by HAL
- Whether any errors were encountered, during its processing
Both of these are essential to know whether the descriptor is eligible
to call process_capture_results() through sendCaptureResults().
When a status(Success/Error) is set on the descriptor, it is ready to
be sent back via sendCaptureResults(). However, this might lead to
undesired results especially when sendCaptureResults() runs in a
different thread (for e.g. stream's post-processor async completion
slot).
This patch decouples the descriptor status (Success/Error) from the
descriptor's completion status (pending or complete). The advantage
of this is we can set the completion status when the descriptor has
been processed fully by the layer and we can set the error status on
the descriptor wherever an error is encountered, throughout the
lifetime of the descriptor in the HAL layer.
While at it, introduce a wrapper completeDescriptor() around
sendCaptureResults(). completeDescriptor() as the name suggests will
mark the descriptor as complete, so it is ready to be sent back.
The locking mechanism is moved from sendCaptureResults() to this wrapper
since the intention is to use completeDescriptor() in place of existing
sendCaptureResults() calls.
Also make sure the sequence of abortRequest() call happens in the same
order at all places i.e. after its added to the descriptors_ queue. Fix
one of the abortRequest() call accordingly.
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Diffstat (limited to 'src/android/camera_device.h')
-rw-r--r-- | src/android/camera_device.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/android/camera_device.h b/src/android/camera_device.h index 863cf414..e544f2bd 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -93,6 +93,7 @@ private: void notifyError(uint32_t frameNumber, camera3_stream_t *stream, camera3_error_msg_code code) const; int processControls(Camera3RequestDescriptor *descriptor); + void completeDescriptor(Camera3RequestDescriptor *descriptor); void sendCaptureResults(); std::unique_ptr<CameraMetadata> getResultMetadata( const Camera3RequestDescriptor &descriptor) const; |