mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-06 06:22:29 +00:00
libs: display: lock at extracting available image formates
When running several vaapi elements at the concurrently, at initialization, there is a race condition when extractin the avaible formats for images and subpictures. This patch add a lock when the those arrays are filled. https://bugzilla.gnome.org/show_bug.cgi?id=797039
This commit is contained in:
parent
f6d827f6ff
commit
1f0b2fb952
1 changed files with 10 additions and 2 deletions
|
@ -649,8 +649,11 @@ ensure_image_formats (GstVaapiDisplay * display)
|
|||
gint i, n;
|
||||
gboolean success = FALSE;
|
||||
|
||||
if (priv->image_formats)
|
||||
GST_VAAPI_DISPLAY_LOCK (display);
|
||||
if (priv->image_formats) {
|
||||
GST_VAAPI_DISPLAY_UNLOCK (display);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
priv->image_formats = g_array_new (FALSE, FALSE, sizeof (GstVaapiFormatInfo));
|
||||
if (!priv->image_formats)
|
||||
|
@ -676,6 +679,7 @@ ensure_image_formats (GstVaapiDisplay * display)
|
|||
|
||||
cleanup:
|
||||
g_free (formats);
|
||||
GST_VAAPI_DISPLAY_UNLOCK (display);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@ -690,8 +694,11 @@ ensure_subpicture_formats (GstVaapiDisplay * display)
|
|||
guint i, n;
|
||||
gboolean success = FALSE;
|
||||
|
||||
if (priv->subpicture_formats)
|
||||
GST_VAAPI_DISPLAY_LOCK (display);
|
||||
if (priv->subpicture_formats) {
|
||||
GST_VAAPI_DISPLAY_UNLOCK (display);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
priv->subpicture_formats =
|
||||
g_array_new (FALSE, FALSE, sizeof (GstVaapiFormatInfo));
|
||||
|
@ -725,6 +732,7 @@ ensure_subpicture_formats (GstVaapiDisplay * display)
|
|||
cleanup:
|
||||
g_free (formats);
|
||||
g_free (flags);
|
||||
GST_VAAPI_DISPLAY_UNLOCK (display);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue