libs: encoder: unref formats array if none

The formats array is always created, in order to keep the logic and
to avoid broken caps, if this formats array doesn't contain any
elements, it has to be unref and the function should return NULL.
This commit is contained in:
Víctor Manuel Jáquez Leal 2020-01-17 12:54:21 +01:00
parent 6eafebc804
commit eda173b3b0

View file

@ -1577,8 +1577,10 @@ gst_vaapi_encoder_get_surface_attributes (GstVaapiEncoder * encoder,
}
}
if (!attribs.formats)
if (attribs.formats->len == 0) {
g_array_unref (attribs.formats);
return NULL;
}
if (min_width)
*min_width = attribs.min_width;