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_request.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_request.h')
-rw-r--r-- | src/android/camera_request.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/android/camera_request.h b/src/android/camera_request.h index 05dabf89..4d80ef32 100644 --- a/src/android/camera_request.h +++ b/src/android/camera_request.h @@ -26,7 +26,6 @@ class Camera3RequestDescriptor { public: enum class Status { - Pending, Success, Error, }; @@ -43,7 +42,7 @@ public: const camera3_capture_request_t *camera3Request); ~Camera3RequestDescriptor(); - bool isPending() const { return status_ == Status::Pending; } + bool isPending() const { return !complete_; } uint32_t frameNumber_ = 0; @@ -53,7 +52,8 @@ public: std::unique_ptr<CaptureRequest> request_; std::unique_ptr<CameraMetadata> resultMetadata_; - Status status_ = Status::Pending; + bool complete_ = false; + Status status_ = Status::Success; private: LIBCAMERA_DISABLE_COPY(Camera3RequestDescriptor) |