[libcamera-devel] [PATCH] gstreamer: libcamerasrc: Delete configuration before stopping camera manager
Nicolas Dufresne
nicolas.dufresne at collabora.com
Wed Nov 4 15:28:59 CET 2020
Le mercredi 04 novembre 2020 à 10:27 +0200, Laurent Pinchart a écrit :
> When closing the libcamerasrc, the reference to camera is released and
> the camera manager is stopped. However, the camera configuration still
> exists at that point, and holds a reference to the camera. This leads to
> a warning from the device enumerator complaining that the media devices
> are still in use:
>
> [1:53:48.792327560] [408] ERROR DeviceEnumerator device_enumerator.cpp:165 Removing media device /dev/media1 while still in use
> [1:53:48.792354022] [408] ERROR DeviceEnumerator device_enumerator.cpp:165 Removing media device /dev/media0 while still in use
>
> A crash follows when the libcamerasrc is finalized, as deleting the
> camera configuration will then release the last reference to the camera,
> which attempts to delete the camera object with deleteLater() without an
> event dispatcher.
>
> Fix it by deleting the camera configuration before stopping the camera
> manager.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>
> ---
> src/gstreamer/gstlibcamerasrc.cpp | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
> index a099508c122a..636c14dff64e 100644
> --- a/src/gstreamer/gstlibcamerasrc.cpp
> +++ b/src/gstreamer/gstlibcamerasrc.cpp
> @@ -499,6 +499,8 @@ gst_libcamera_src_close(GstLibcameraSrc *self)
>
>
>
>
> GST_DEBUG_OBJECT(self, "Releasing resources");
>
>
>
>
> + state->config_.reset();
> +
> ret = state->cam_->release();
> if (ret) {
> GST_ELEMENT_WARNING(self, RESOURCE, BUSY,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20201104/4f19035f/attachment.sig>
More information about the libcamera-devel
mailing list