[libcamera-devel] [PATCH v5 5/8] android: camera_device: Create the Request and Camera3RequestDescriptor together
Kieran Bingham
kieran.bingham at ideasonboard.com
Tue Jul 7 01:02:37 CEST 2020
Move the construction of the Request higher in the code flow so that
multiple buffers and streams can be added where required.
Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
---
src/android/camera_device.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 73cfab532cf5..4e77a92dbea5 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1066,6 +1066,10 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
Camera3RequestDescriptor *descriptor =
new Camera3RequestDescriptor(camera3Request->frame_number,
camera3Request->num_output_buffers);
+
+ Request *request =
+ camera_->createRequest(reinterpret_cast<uint64_t>(descriptor));
+
for (unsigned int i = 0; i < descriptor->numBuffers; ++i) {
/*
* Keep track of which stream the request belongs to and store
@@ -1085,12 +1089,11 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
FrameBuffer *buffer = createFrameBuffer(*camera3Buffers[0].buffer);
if (!buffer) {
LOG(HAL, Error) << "Failed to create buffer";
+ delete request;
delete descriptor;
return -ENOMEM;
}
- Request *request =
- camera_->createRequest(reinterpret_cast<uint64_t>(descriptor));
request->addBuffer(stream, buffer);
int ret = camera_->queueRequest(request);
--
2.25.1
More information about the libcamera-devel
mailing list