v4l2: dec/enc: Flag leaked caps

We never free class held template caps, so flag the one that wasn't already
flagged.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7540>
This commit is contained in:
Nicolas Dufresne 2024-09-17 14:27:46 -04:00 committed by GStreamer Marge Bot
parent d35f348af3
commit a6959f3738
2 changed files with 7 additions and 1 deletions

View file

@ -1446,11 +1446,16 @@ gst_v4l2_video_dec_register (GstPlugin * plugin, const gchar * basename,
cdata->device = g_strdup (device_path);
cdata->sink_caps = gst_caps_new_empty ();
gst_caps_append_structure (cdata->sink_caps, gst_structure_copy (s));
GST_MINI_OBJECT_FLAG_SET (cdata->sink_caps,
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
cdata->src_caps = gst_caps_ref (src_caps);
type_name = gst_v4l2_video_dec_set_metadata (s, cdata, basename);
/* Skip over if we hit an unmapped type */
if (!type_name) {
g_free (cdata->device);
gst_caps_unref (cdata->sink_caps);
gst_caps_unref (cdata->src_caps);
g_free (cdata);
continue;
}

View file

@ -1227,6 +1227,7 @@ gst_v4l2_video_enc_register (GstPlugin * plugin, GType type,
GValue value = G_VALUE_INIT;
filtered_caps = gst_caps_intersect (src_caps, codec_caps);
GST_MINI_OBJECT_FLAG_SET (filtered_caps, GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
if (codec != NULL && video_fd != -1) {
if (gst_v4l2_codec_probe_levels (codec, video_fd, &value)) {
@ -1243,7 +1244,7 @@ gst_v4l2_video_enc_register (GstPlugin * plugin, GType type,
cdata = g_new0 (GstV4l2VideoEncCData, 1);
cdata->device = g_strdup (device_path);
cdata->sink_caps = gst_caps_ref (sink_caps);
cdata->src_caps = gst_caps_ref (filtered_caps);
cdata->src_caps = filtered_caps;
cdata->codec = codec;
g_type_query (type, &type_query);