From f72c7131aefc812b893b1519ad7fe4b61e489950 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Wed, 16 May 2018 20:16:44 -0400 Subject: [PATCH] v4l2object: Don't open the device in get property This is both racy and inefficient. This function is still missing some locking which will be address in later patch. https://bugzilla.gnome.org/show_bug.cgi?id=796185 --- sys/v4l2/gstv4l2object.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index f0f8d0b22b..b4c8f7886a 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -720,15 +720,12 @@ gst_v4l2_object_get_property_helper (GstV4l2Object * v4l2object, break; case PROP_DEVICE_NAME: { - const guchar *new = NULL; + const guchar *name = NULL; - if (GST_V4L2_IS_OPEN (v4l2object)) { - new = v4l2object->vcap.card; - } else if (gst_v4l2_open (v4l2object)) { - new = v4l2object->vcap.card; - gst_v4l2_close (v4l2object); - } - g_value_set_string (value, (gchar *) new); + if (GST_V4L2_IS_OPEN (v4l2object)) + name = v4l2object->vcap.card; + + g_value_set_string (value, (gchar *) name); break; } case PROP_DEVICE_FD: