gstreamer: Use copied camera name

The camera name is copied in gst_libcamera_src_open() as we can't hold
the lock protecting the name while calling GST_ELEMENT_ERROR(). The
GST_ELEMENT_ERROR() macro sends a message on the bus, taking more locks
and possibly causing issues.

However, the current code makes the copy, but does not actually use it.
So fix that.

Fixes: 58feb69f85 ("gst: libcamerasrc: Implement selection and acquisition")
Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Barnabás Pőcze 2024-05-14 18:02:07 +00:00 committed by Laurent Pinchart
parent f113464b34
commit e43d2a35fa

View file

@ -377,10 +377,10 @@ gst_libcamera_src_open(GstLibcameraSrc *self)
} }
if (camera_name) { if (camera_name) {
cam = cm->get(self->camera_name); cam = cm->get(camera_name);
if (!cam) { if (!cam) {
GST_ELEMENT_ERROR(self, RESOURCE, NOT_FOUND, GST_ELEMENT_ERROR(self, RESOURCE, NOT_FOUND,
("Could not find a camera named '%s'.", self->camera_name), ("Could not find a camera named '%s'.", camera_name),
("libcamera::CameraMananger::get() returned nullptr")); ("libcamera::CameraMananger::get() returned nullptr"));
return false; return false;
} }