Commit b6723ecd authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte Committed by Nicolas Dufresne

v4l2object: mark singleton caps as "may be leaked" objects.

Set MAY_BE_LEAKED flag on static pads returned by gst_v4l2_object_get_*_caps()
functions. Made functions thread safe by using g_once_init[enter|leave]
funtions.

https://bugzilla.gnome.org/show_bug.cgi?id=778453
parent 5c030370
......@@ -1577,10 +1577,13 @@ gst_v4l2_object_get_all_caps (void)
{
static GstCaps *caps = NULL;
if (caps == NULL)
caps = gst_v4l2_object_get_caps_helper (GST_V4L2_ALL);
if (g_once_init_enter (&caps)) {
GstCaps *all_caps = gst_v4l2_object_get_caps_helper (GST_V4L2_ALL);
GST_MINI_OBJECT_FLAG_SET (all_caps, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
g_once_init_leave (&caps, all_caps);
}
return gst_caps_ref (caps);
return caps;
}
GstCaps *
......@@ -1588,10 +1591,13 @@ gst_v4l2_object_get_raw_caps (void)
{
static GstCaps *caps = NULL;
if (caps == NULL)
caps = gst_v4l2_object_get_caps_helper (GST_V4L2_RAW);
if (g_once_init_enter (&caps)) {
GstCaps *raw_caps = gst_v4l2_object_get_caps_helper (GST_V4L2_RAW);
GST_MINI_OBJECT_FLAG_SET (raw_caps, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
g_once_init_leave (&caps, raw_caps);
}
return gst_caps_ref (caps);
return caps;
}
GstCaps *
......@@ -1599,10 +1605,13 @@ gst_v4l2_object_get_codec_caps (void)
{
static GstCaps *caps = NULL;
if (caps == NULL)
caps = gst_v4l2_object_get_caps_helper (GST_V4L2_CODEC);
if (g_once_init_enter (&caps)) {
GstCaps *codec_caps = gst_v4l2_object_get_caps_helper (GST_V4L2_CODEC);
GST_MINI_OBJECT_FLAG_SET (codec_caps, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
g_once_init_leave (&caps, codec_caps);
}
return gst_caps_ref (caps);
return caps;
}
/* collect data for the given caps
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment