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>
This commit is contained in:
parent
ed9eb080e9
commit
64bcbd0e2c
4 changed files with 19 additions and 19 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue