[libcamera-devel] [PATCH v2 5/9] android: camera_device: Create the Request and Camera3RequestDescriptor together
Kieran Bingham
kieran.bingham at ideasonboard.com
Thu Jul 2 23:36:50 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>
---
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 78ecfd7c2ee2..77083219d8a1 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 = newFrameBuffer(*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