libcamera: camera: Make stop() idempotent
Make Camera::stop() idempotent so that it can be called in any state and consecutive times. When called in any state other than CameraRunning, it is a no-op. This simplifies the cleanup path for applications. Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
d7415bc4e4
commit
b0bf6b0aa9
2 changed files with 25 additions and 10 deletions
|
@ -41,13 +41,13 @@ protected:
|
|||
if (camera_->queueRequest(&request) != -EACCES)
|
||||
return TestFail;
|
||||
|
||||
if (camera_->stop() != -EACCES)
|
||||
return TestFail;
|
||||
|
||||
/* Test operations which should pass. */
|
||||
if (camera_->release())
|
||||
return TestFail;
|
||||
|
||||
if (camera_->stop())
|
||||
return TestFail;
|
||||
|
||||
/* Test valid state transitions, end in Acquired state. */
|
||||
if (camera_->acquire())
|
||||
return TestFail;
|
||||
|
@ -71,7 +71,8 @@ protected:
|
|||
if (camera_->queueRequest(&request) != -EACCES)
|
||||
return TestFail;
|
||||
|
||||
if (camera_->stop() != -EACCES)
|
||||
/* Test operations which should pass. */
|
||||
if (camera_->stop())
|
||||
return TestFail;
|
||||
|
||||
/* Test valid state transitions, end in Configured state. */
|
||||
|
@ -97,14 +98,14 @@ protected:
|
|||
if (camera_->queueRequest(&request1) != -EACCES)
|
||||
return TestFail;
|
||||
|
||||
if (camera_->stop() != -EACCES)
|
||||
return TestFail;
|
||||
|
||||
/* Test operations which should pass. */
|
||||
std::unique_ptr<Request> request2 = camera_->createRequest();
|
||||
if (!request2)
|
||||
return TestFail;
|
||||
|
||||
if (camera_->stop())
|
||||
return TestFail;
|
||||
|
||||
/* Test valid state transitions, end in Running state. */
|
||||
if (camera_->release())
|
||||
return TestFail;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue