summaryrefslogtreecommitdiff
path: root/src/android/camera_device.cpp
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2020-07-01 13:28:16 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2020-07-06 23:58:42 +0100
commiteac0542c5e15137854e9ecf864da9953960dbcd8 (patch)
treea56bfdc241072cb29e0b2d795c1d820629907b37 /src/android/camera_device.cpp
parent74ab442dcfe31428674896bd295463fdff0568b0 (diff)
android: camera_device: Create the Request and Camera3RequestDescriptor together
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@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/android/camera_device.cpp')
-rw-r--r--src/android/camera_device.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 73cfab53..4e77a92d 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);