libs: context: create context first before using it to create surface.

In gst_vaapi_context_reset(), if the context has to be destroyed, make
sure to create it first before allocating its associated surfaces.

This patch fixes a regression introduced in commit 82872f4 because
the formats available in the current context now are ensured before
creating the context's surfaces.

https://bugzilla.gnome.org/show_bug.cgi?id=797277
This commit is contained in:
Wangfei 2018-10-12 16:37:34 +08:00 committed by Víctor Manuel Jáquez Leal
parent 70726aef00
commit ecdfc623fd

View file

@ -531,12 +531,12 @@ gst_vaapi_context_reset (GstVaapiContext * context,
if (reset_config)
context_destroy (context);
if (reset_config && !(config_create (context) && context_create (context)))
return FALSE;
if (reset_surfaces && !context_create_surfaces (context))
return FALSE;
else if (grow_surfaces && !context_ensure_surfaces (context))
return FALSE;
if (reset_config && !(config_create (context) && context_create (context)))
return FALSE;
return TRUE;
}