validate:ssim: Avoid segfaults trying to attach pads without a template

This commit is contained in:
Thibault Saunier 2020-01-06 16:29:33 -03:00
parent d654a4049b
commit 78f2026467

View file

@ -306,13 +306,21 @@ _can_attach (GstValidateOverride * override, GstValidateMonitor * monitor)
pad = GST_PAD (gst_validate_monitor_get_target (monitor));
element = gst_validate_monitor_get_element (monitor);
if ((gst_validate_element_has_klass (element, "Converter") ||
gst_validate_element_has_klass (element, "Filter")) &&
gst_validate_element_has_klass (element, "Filter") ||
gst_validate_element_has_klass (element, "Decoder")) &&
GST_PAD_IS_SINK (pad)) {
GST_INFO_OBJECT (override, "Not attaching on filter sinkpads");
GST_INFO_OBJECT (override, "Not attaching on filter or decoder sinkpads");
goto fail;
}
if (!GST_PAD_PAD_TEMPLATE (pad)) {
GST_INFO_OBJECT (pad,
"Doesn't have template, can't use it %" GST_PTR_FORMAT,
gst_pad_query_caps (pad, NULL));
return FALSE;
}
template_caps = GST_PAD_TEMPLATE_CAPS (GST_PAD_PAD_TEMPLATE (pad));
for (i = 0; i < gst_caps_get_size (template_caps); i++) {
structure = gst_caps_get_structure (template_caps, i);