From e8b52f59f54573b459ce2f00c02a0633923543a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Sun, 18 Aug 2019 13:53:53 +0200 Subject: [PATCH] vaapidecode: guard if no structure is available in caps --- gst/vaapi/gstvaapidecode.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index 6f58906..c93dcd6 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -325,6 +325,8 @@ gst_vaapidecode_update_src_caps (GstVaapiDecode * decode) case GST_VAAPI_CAPS_FEATURE_DMABUF: case GST_VAAPI_CAPS_FEATURE_VAAPI_SURFACE:{ GstStructure *structure = gst_caps_get_structure (state->caps, 0); + if (!structure) + break; /* Remove chroma-site and colorimetry from src caps, * which is unnecessary on downstream if using VASurface @@ -886,6 +888,9 @@ gst_vaapidecode_create (GstVaapiDecode * decode, GstCaps * caps) GstStructure *const structure = gst_caps_get_structure (caps, 0); const gchar *str = NULL; + if (!structure) + break; + if ((str = gst_structure_get_string (structure, "alignment"))) { GstVaapiStreamAlignH264 alignment; if (g_strcmp0 (str, "au") == 0) @@ -914,6 +919,9 @@ gst_vaapidecode_create (GstVaapiDecode * decode, GstCaps * caps) GstStructure *const structure = gst_caps_get_structure (caps, 0); const gchar *str = NULL; + if (!structure) + break; + if ((str = gst_structure_get_string (structure, "alignment"))) { GstVaapiStreamAlignH265 alignment; if (g_strcmp0 (str, "au") == 0) @@ -1249,6 +1257,8 @@ gst_vaapidecode_ensure_allowed_sinkpad_caps (GstVaapiDecode * decode) if (!caps) continue; structure = gst_caps_get_structure (caps, 0); + if (!structure) + continue; profile_name = gst_vaapi_profile_get_name (profile); if (profile_name) -- 2.7.4