[libcamera-devel] checking camera state for shutdown
Kieran Bingham
kieran.bingham at ideasonboard.com
Thu Sep 22 10:35:27 CEST 2022
Quoting Christian Rauch via libcamera-devel (2022-09-21 23:01:47)
> Hi,
>
> I am trying to shut down the camera and camera manager properly, but I
> am getting messages such as "Camera in Stopping state trying
> queueRequest() requiring state Running" and "Removing media device
> /dev/media1 while still in use".
>
> The general approach I am using is to
> 1. disconnect callbacks:
> camera->requestCompleted.disconnect();
> 2. stop camera:
> camera->stop();
> camera->release();
> 3. stop camera manager:
> camera_manager.stop();
>
> But the messages above tell me that my callbacks, which re-queue the
> requests, are not finished before I call stop, and the camera has not
> been stopped when I stop the camera manager. I can work around this by a
> "sleep(1)" after the disconnect, but this is not nice.
Hrm... I think we normally disconnect after stopping the camera.
Though that should still work I would expect, but ...
> Since the camera state is only accessible via internal/private API, how
> is a user supposed to control the ordered shutdown of cameras etc.? Do
> we need public API that lets a user check the camera state? Or should
> the disconnect, stop and release calls make sure that the objects reach
> these states before returning?
Calling camera->stop() should indeed already block until the camera is
stopped.
At first I thought the lack of a requestCompleted handler might mean
libcamera is still holding on to the requests and hasn't been able to
get them back to the application - but I think they would just leak, and
be lost. That could be the problem.
> Best,
> Christian
>
More information about the libcamera-devel
mailing list