From ec5d4acfcaacc687c6bcb9b3c32325c210c4a0f0 Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Wed, 24 Mar 2021 11:11:21 +0000 Subject: 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 Reviewed-by: Laurent Pinchart Signed-off-by: Kieran Bingham --- src/libcamera/pipeline_handler.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/libcamera/pipeline_handler.cpp') 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 @@ -368,6 +368,21 @@ const ControlList &PipelineHandler::properties(const Camera *camera) const * \context This function is called from the CameraManager thread. */ +/** + * \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 -- cgit v1.2.1