libcamera: camera: Validate requests are completed in Running state

All requests must have completed before the Camera has fully stopped.

Requests completing when the camera is not running represent an internal
pipeline handler bug.

Trap this event with a fatal error.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Kieran Bingham
2021-03-10 17:40:20 +00:00
parent 1dfb8d45dc
commit 5718b4d5b7
+8 -2
View File
@@ -1062,11 +1062,11 @@ int Camera::stop()
LOG(Camera, Debug) << "Stopping capture";
d->setState(Private::CameraConfigured);
d->pipe_->invokeMethod(&PipelineHandler::stop, ConnectionTypeBlocking,
this);
d->setState(Private::CameraConfigured);
return 0;
}
@@ -1079,6 +1079,12 @@ int Camera::stop()
*/
void Camera::requestComplete(Request *request)
{
Private *const d = LIBCAMERA_D_PTR();
/* Disconnected cameras are still able to complete requests. */
if (d->isAccessAllowed(Private::CameraRunning, true))
LOG(Camera, Fatal) << "Trying to complete a request when stopped";
requestCompleted.emit(request);
}