mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 07:19:45 +03:00
android: camera_device: Fix race on queuing capture request
The Camera3RequestDescriptor containing the capture request is added to the descriptors_ map after a call to CameraWorker::queueRequest(). This is a race condition since CameraWorker::queueRequest() queues requests to libcamera::Camera asynchronously. The requests may thus complete before they get added to descriptors_, in which case requestComplete() will fail to lookup the request in the map. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
This commit is contained in:
parent
03c9b1a0a4
commit
7f035328fb
1 changed files with 3 additions and 1 deletions
|
@ -1065,13 +1065,15 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
|
|||
state_ = State::Running;
|
||||
}
|
||||
|
||||
worker_.queueRequest(descriptor.request_.get());
|
||||
CaptureRequest *request = descriptor.request_.get();
|
||||
|
||||
{
|
||||
MutexLocker descriptorsLock(descriptorsMutex_);
|
||||
descriptors_[descriptor.request_->cookie()] = std::move(descriptor);
|
||||
}
|
||||
|
||||
worker_.queueRequest(request);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue