libs: display: lock ensure_profile()

Thread safety patch for ensure_profile() function

Fixes #133
This commit is contained in:
Denis Nagorny 2019-02-08 09:21:28 +03:00 committed by Víctor Manuel Jáquez Leal
parent 3fd91adc00
commit 4aae03d3c1

View file

@ -463,8 +463,12 @@ ensure_profiles (GstVaapiDisplay * display)
VAStatus status; VAStatus status;
gboolean success = FALSE; gboolean success = FALSE;
if (priv->has_profiles) GST_VAAPI_DISPLAY_LOCK (display);
if (priv->has_profiles) {
GST_VAAPI_DISPLAY_UNLOCK (display);
return TRUE; return TRUE;
}
priv->decoders = g_array_new (FALSE, FALSE, sizeof (GstVaapiConfig)); priv->decoders = g_array_new (FALSE, FALSE, sizeof (GstVaapiConfig));
if (!priv->decoders) if (!priv->decoders)
@ -545,6 +549,7 @@ ensure_profiles (GstVaapiDisplay * display)
cleanup: cleanup:
g_free (profiles); g_free (profiles);
g_free (entrypoints); g_free (entrypoints);
GST_VAAPI_DISPLAY_UNLOCK (display);
return success; return success;
} }