summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2021-03-24 11:11:21 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-04-22 16:56:07 +0100
commitec5d4acfcaacc687c6bcb9b3c32325c210c4a0f0 (patch)
tree216cffe91b423bbf1a14451bda628a6fa4b8ec0e /src
parent7e0da7c34900cb219ee447df547162211d8683e3 (diff)
libcamera: camera: Assert pipelines complete all requests
When the camera manager calls stop on a pipeline, it is expected that the pipeline handler guarantees all requests are returned back to the application before the camera has stopped. Ensure that this guarantee is met by providing an accessor on the pipeline handler to validate that all pending requests are removed. Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/camera.cpp2
-rw-r--r--src/libcamera/pipeline_handler.cpp15
2 files changed, 17 insertions, 0 deletions
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index 763f3b99..1340c266 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -1084,6 +1084,8 @@ int Camera::stop()
d->pipe_->invokeMethod(&PipelineHandler::stop, ConnectionTypeBlocking,
this);
+ ASSERT(!d->pipe_->hasPendingRequests(this));
+
d->setState(Private::CameraConfigured);
return 0;
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index 3b3150bd..f41b7a7b 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -369,6 +369,21 @@ const ControlList &PipelineHandler::properties(const Camera *camera) const
*/
/**
+ * \brief Determine if the camera has any requests pending
+ * \param[in] camera The camera to check
+ *
+ * This method determines if there are any requests queued to the pipeline
+ * awaiting processing.
+ *
+ * \return True if there are pending requests, or false otherwise
+ */
+bool PipelineHandler::hasPendingRequests(const Camera *camera) const
+{
+ const CameraData *data = cameraData(camera);
+ return !data->queuedRequests_.empty();
+}
+
+/**
* \fn PipelineHandler::queueRequest()
* \brief Queue a request
* \param[in] request The request to queue