libs: context: create context first before using it to create surface.
authorWangfei <fei.w.wang@intel.com>
Fri, 12 Oct 2018 08:37:34 +0000 (16:37 +0800)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Mon, 15 Oct 2018 14:54:02 +0000 (16:54 +0200)
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

gst-libs/gst/vaapi/gstvaapicontext.c

index dcce889..35d2212 100644 (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;
 }