libcamera: pipeline: Introduce stopDevice()
Since a queue of waiting Requests has been introduced, not all Requests queued to the PipelineHandler are immediately queued to the device. As a Camera can be stopped at any time, it is required to complete the waiting requests after the ones queued to the device had been completed. Introduce a pure virtual PipelineHandler::stopDevice() function to be implemented by pipeline handlers and make the PipelineHandler::stop() function call it before completing pending requests. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
@@ -267,8 +267,7 @@ void PipelineHandler::unlock()
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn PipelineHandler::stop()
|
||||
* \brief Stop capturing from all running streams
|
||||
* \brief Stop capturing from all running streams and cancel pending requests
|
||||
* \param[in] camera The camera to stop
|
||||
*
|
||||
* This function stops capturing and processing requests immediately. All
|
||||
@@ -276,6 +275,33 @@ void PipelineHandler::unlock()
|
||||
*
|
||||
* \context This function is called from the CameraManager thread.
|
||||
*/
|
||||
void PipelineHandler::stop(Camera *camera)
|
||||
{
|
||||
/* Stop the pipeline handler and let the queued requests complete. */
|
||||
stopDevice(camera);
|
||||
|
||||
/* Cancel and signal as complete all waiting requests. */
|
||||
while (!waitingRequests_.empty()) {
|
||||
Request *request = waitingRequests_.front();
|
||||
waitingRequests_.pop();
|
||||
|
||||
request->_d()->cancel();
|
||||
completeRequest(request);
|
||||
}
|
||||
|
||||
/* Make sure no requests are pending. */
|
||||
Camera::Private *data = camera->_d();
|
||||
ASSERT(data->queuedRequests_.empty());
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn PipelineHandler::stopDevice()
|
||||
* \brief Stop capturing from all running streams
|
||||
* \param[in] camera The camera to stop
|
||||
*
|
||||
* This function stops capturing and processing requests immediately. All
|
||||
* pending requests are cancelled and complete immediately in an error state.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Determine if the camera has any requests pending
|
||||
|
||||
Reference in New Issue
Block a user