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:
@@ -80,6 +80,7 @@ public:
|
||||
|
||||
virtual int start(Camera *camera, const ControlList *controls) = 0;
|
||||
virtual void stop(Camera *camera) = 0;
|
||||
bool hasPendingRequests(const Camera *camera) const;
|
||||
|
||||
void queueRequest(Request *request);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user