mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-17 01:15:06 +03:00
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>
This commit is contained in:
parent
7e0da7c349
commit
ec5d4acfca
3 changed files with 18 additions and 0 deletions
|
@ -80,6 +80,7 @@ public:
|
||||||
|
|
||||||
virtual int start(Camera *camera, const ControlList *controls) = 0;
|
virtual int start(Camera *camera, const ControlList *controls) = 0;
|
||||||
virtual void stop(Camera *camera) = 0;
|
virtual void stop(Camera *camera) = 0;
|
||||||
|
bool hasPendingRequests(const Camera *camera) const;
|
||||||
|
|
||||||
void queueRequest(Request *request);
|
void queueRequest(Request *request);
|
||||||
|
|
||||||
|
|
|
@ -1084,6 +1084,8 @@ int Camera::stop()
|
||||||
d->pipe_->invokeMethod(&PipelineHandler::stop, ConnectionTypeBlocking,
|
d->pipe_->invokeMethod(&PipelineHandler::stop, ConnectionTypeBlocking,
|
||||||
this);
|
this);
|
||||||
|
|
||||||
|
ASSERT(!d->pipe_->hasPendingRequests(this));
|
||||||
|
|
||||||
d->setState(Private::CameraConfigured);
|
d->setState(Private::CameraConfigured);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -368,6 +368,21 @@ const ControlList &PipelineHandler::properties(const Camera *camera) const
|
||||||
* \context This function is called from the CameraManager thread.
|
* \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()
|
* \fn PipelineHandler::queueRequest()
|
||||||
* \brief Queue a request
|
* \brief Queue a request
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue