summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2018-08-30 18:56:40 +0200
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2018-08-31 16:58:53 +0200
commit4ae96e9b4df1a8bf97ddc9fd66f0a022bec097c8 (patch)
treea0ed63b4234f6a995ad3d1d4ab7b01e71473f4ea
parentb7b342218e4a797ccb70d1ac2d917b8bd172efce (diff)
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
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay.c b/gst-libs/gst/vaapi/gstvaapidisplay.c
index 037f42a0..9921ae8f 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay.c
+++ b/gst-libs/gst/vaapi/gstvaapidisplay.c
@@ -654,8 +654,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)
@@ -681,6 +684,7 @@ ensure_image_formats (GstVaapiDisplay * display)
cleanup:
g_free (formats);
+ GST_VAAPI_DISPLAY_UNLOCK (display);
return success;
}
@@ -695,8 +699,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));
@@ -730,6 +737,7 @@ ensure_subpicture_formats (GstVaapiDisplay * display)
cleanup:
g_free (formats);
g_free (flags);
+ GST_VAAPI_DISPLAY_UNLOCK (display);
return success;
}