mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
display: fix validation process of properties during discovery.
Some VA drivers (e.g. EMGD) can have completely random values for initial display attributes. So, try to improve the discovery process to check the initial display attribute values actually fall within valid bounds. If not, try to reset those to some sensible values like the default value reported through vaQueryDisplayAttributes().
This commit is contained in:
parent
fafcf0e13c
commit
8ebe4d63d5
1 changed files with 18 additions and 2 deletions
|
@ -609,6 +609,7 @@ gst_vaapi_display_create(GstVaapiDisplay *display)
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
VADisplayAttribute * const attr = &display_attrs[i];
|
VADisplayAttribute * const attr = &display_attrs[i];
|
||||||
GstVaapiProperty prop;
|
GstVaapiProperty prop;
|
||||||
|
gint value;
|
||||||
|
|
||||||
GST_DEBUG(" %s", string_of_VADisplayAttributeType(attr->type));
|
GST_DEBUG(" %s", string_of_VADisplayAttributeType(attr->type));
|
||||||
|
|
||||||
|
@ -645,8 +646,23 @@ gst_vaapi_display_create(GstVaapiDisplay *display)
|
||||||
|
|
||||||
/* Assume the attribute is really supported if we can get the
|
/* Assume the attribute is really supported if we can get the
|
||||||
* actual and current value */
|
* actual and current value */
|
||||||
|
if (!get_attribute(display, attr->type, &value))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Some drivers (e.g. EMGD) have completely random initial
|
||||||
|
* values. So try to reset sensible ones */
|
||||||
|
if (value < attr->min_value || value > attr->max_value) {
|
||||||
|
gint v;
|
||||||
|
if (!(attr->flags & VA_DISPLAY_ATTRIB_SETTABLE))
|
||||||
|
continue;
|
||||||
|
if (!set_attribute(display, attr->type, attr->value))
|
||||||
|
continue;
|
||||||
|
if (!get_attribute(display, attr->type, &v) || v != value)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
prop.attribute = *attr;
|
prop.attribute = *attr;
|
||||||
if (get_attribute(display, attr->type, &prop.old_value))
|
prop.old_value = value;
|
||||||
g_array_append_val(priv->properties, prop);
|
g_array_append_val(priv->properties, prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue