From c753223ad6b90550fae31aedd79fbedc13da2e75 Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Wed, 23 Sep 2020 19:05:41 +0900 Subject: libcamera, android, cam, gstreamer, qcam, v4l2: Reuse Request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow reuse of the Request object by implementing reuse(). This means the applications now have the responsibility of freeing the Request objects, so make all libcamera users (cam, qcam, v4l2-compat, gstreamer, android) do so. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- test/camera/statemachine.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'test/camera/statemachine.cpp') diff --git a/test/camera/statemachine.cpp b/test/camera/statemachine.cpp index 28faeb91..e63ab298 100644 --- a/test/camera/statemachine.cpp +++ b/test/camera/statemachine.cpp @@ -101,13 +101,10 @@ protected: return TestFail; /* Test operations which should pass. */ - Request *request2 = camera_->createRequest(); + std::unique_ptr request2 = camera_->createRequest(); if (!request2) return TestFail; - /* Never handed to hardware so need to manually delete it. */ - delete request2; - /* Test valid state transitions, end in Running state. */ if (camera_->release()) return TestFail; @@ -146,7 +143,7 @@ protected: return TestFail; /* Test operations which should pass. */ - Request *request = camera_->createRequest(); + std::unique_ptr request = camera_->createRequest(); if (!request) return TestFail; @@ -154,7 +151,7 @@ protected: if (request->addBuffer(stream, allocator_->buffers(stream)[0].get())) return TestFail; - if (camera_->queueRequest(request)) + if (camera_->queueRequest(request.get())) return TestFail; /* Test valid state transitions, end in Available state. */ -- cgit v1.2.1