libs: context: fix wrong counter of the array of attributes

The counter value passed to vaCreateConfig is always +1.

This is a regression caused by commit e42ec3ad.

The present patch fixes wrong counting of the array of attributes.

https://bugzilla.gnome.org/show_bug.cgi?id=787613
This commit is contained in:
Hyunjun Ko 2017-09-13 15:44:32 +09:00 committed by Víctor Manuel Jáquez Leal
parent 5333155e27
commit 9875c0d84e

View file

@ -241,7 +241,7 @@ config_create (GstVaapiContext * context)
gst_vaapi_entrypoint_get_va_entrypoint (cip->entrypoint); gst_vaapi_entrypoint_get_va_entrypoint (cip->entrypoint);
attrib_index = 0; attrib_index = 0;
attrib = &attribs[attrib_index++]; attrib = &attribs[attrib_index];
g_assert (attrib_index < G_N_ELEMENTS (attribs)); g_assert (attrib_index < G_N_ELEMENTS (attribs));
/* Validate VA surface format */ /* Validate VA surface format */
@ -257,7 +257,7 @@ config_create (GstVaapiContext * context)
goto cleanup; goto cleanup;
} }
attrib->value = va_chroma_format; attrib->value = va_chroma_format;
attrib = &attribs[attrib_index++]; attrib = &attribs[++attrib_index];
g_assert (attrib_index < G_N_ELEMENTS (attribs)); g_assert (attrib_index < G_N_ELEMENTS (attribs));
switch (cip->usage) { switch (cip->usage) {
@ -280,7 +280,7 @@ config_create (GstVaapiContext * context)
goto cleanup; goto cleanup;
} }
attrib->value = va_rate_control; attrib->value = va_rate_control;
attrib = &attribs[attrib_index++]; attrib = &attribs[++attrib_index];
g_assert (attrib_index < G_N_ELEMENTS (attribs)); g_assert (attrib_index < G_N_ELEMENTS (attribs));
} }
/* Packed headers */ /* Packed headers */
@ -295,7 +295,7 @@ config_create (GstVaapiContext * context)
goto cleanup; goto cleanup;
} }
attrib->value = config->packed_headers; attrib->value = config->packed_headers;
attrib = &attribs[attrib_index++]; attrib = &attribs[++attrib_index];
g_assert (attrib_index < G_N_ELEMENTS (attribs)); g_assert (attrib_index < G_N_ELEMENTS (attribs));
} }
#if VA_CHECK_VERSION(0,37,0) #if VA_CHECK_VERSION(0,37,0)
@ -304,7 +304,7 @@ config_create (GstVaapiContext * context)
if (!context_get_attribute (context, attrib->type, &value)) if (!context_get_attribute (context, attrib->type, &value))
goto cleanup; goto cleanup;
attrib->value = value; attrib->value = value;
attrib = &attribs[attrib_index++]; attrib = &attribs[++attrib_index];
g_assert (attrib_index < G_N_ELEMENTS (attribs)); g_assert (attrib_index < G_N_ELEMENTS (attribs));
} }
#endif #endif
@ -324,14 +324,14 @@ config_create (GstVaapiContext * context)
goto cleanup; goto cleanup;
} }
attrib->value = value; attrib->value = value;
attrib = &attribs[attrib_index++]; attrib = &attribs[++attrib_index];
g_assert (attrib_index < G_N_ELEMENTS (attribs)); g_assert (attrib_index < G_N_ELEMENTS (attribs));
} }
#endif #endif
#if USE_H264_FEI_ENCODER #if USE_H264_FEI_ENCODER
if (cip->entrypoint == GST_VAAPI_ENTRYPOINT_SLICE_ENCODE_FEI) { if (cip->entrypoint == GST_VAAPI_ENTRYPOINT_SLICE_ENCODE_FEI) {
attrib->type = (VAConfigAttribType) VAConfigAttribFEIFunctionType; attrib->type = (VAConfigAttribType) VAConfigAttribFEIFunctionType;
attrib = &attribs[attrib_index++]; attrib = &attribs[++attrib_index];
g_assert (attrib_index < G_N_ELEMENTS (attribs)); g_assert (attrib_index < G_N_ELEMENTS (attribs));
/* FIXME: Query the read-only supported MV predictors */ /* FIXME: Query the read-only supported MV predictors */
} }