From df0958e85507e8b00d26d7b7751f2e7e63335395 Mon Sep 17 00:00:00 2001 From: Haihua Hu Date: Fri, 1 Apr 2022 21:47:59 +0800 Subject: [PATCH] ximagesink/xvimagesink: use GST_XINITTHREADS to ensure call to XInitThreads Part-of: --- subprojects/gst-devtools/validate/launcher/baseclasses.py | 2 ++ subprojects/gst-plugins-base/ext/gl/gstglelement.c | 2 +- subprojects/gst-plugins-base/sys/ximage/ximage.c | 3 +++ subprojects/gst-plugins-base/sys/xvimage/xvimage.c | 3 +++ subprojects/gst-plugins-base/tests/check/elements/glfilter.c | 1 + .../gst-plugins-base/tests/check/elements/glimagesink.c | 1 + subprojects/gst-plugins-base/tests/check/elements/glmixer.c | 1 + subprojects/gst-plugins-base/tests/check/elements/glstereo.c | 1 + subprojects/gst-plugins-base/tools/gst-play.c | 1 + subprojects/gstreamer/tools/gst-launch.c | 1 + 10 files changed, 15 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-devtools/validate/launcher/baseclasses.py b/subprojects/gst-devtools/validate/launcher/baseclasses.py index e3b0a1d32c..8b2cf76221 100644 --- a/subprojects/gst-devtools/validate/launcher/baseclasses.py +++ b/subprojects/gst-devtools/validate/launcher/baseclasses.py @@ -933,6 +933,8 @@ class GstValidateTest(Test): # Ensure XInitThreads is called, see bgo#731525 subproc_env['GST_GL_XINITTHREADS'] = '1' self.add_env_variable('GST_GL_XINITTHREADS', '1') + subproc_env['GST_XINITTHREADS'] = '1' + self.add_env_variable('GST_XINITTHREADS', '1') if self.scenario is not None: scenario = self.scenario.get_execution_name() diff --git a/subprojects/gst-plugins-base/ext/gl/gstglelement.c b/subprojects/gst-plugins-base/ext/gl/gstglelement.c index 1662b7355c..0b4269c73f 100644 --- a/subprojects/gst-plugins-base/ext/gl/gstglelement.c +++ b/subprojects/gst-plugins-base/ext/gl/gstglelement.c @@ -62,7 +62,7 @@ gl_element_init (GstPlugin * plugin) #endif #if GST_GL_HAVE_WINDOW_X11 - if (g_getenv ("GST_GL_XINITTHREADS")) + if (g_getenv ("GST_GL_XINITTHREADS") || g_getenv ("GST_XINITTHREADS")) XInitThreads (); #endif g_once_init_leave (&res, TRUE); diff --git a/subprojects/gst-plugins-base/sys/ximage/ximage.c b/subprojects/gst-plugins-base/sys/ximage/ximage.c index 0a48c8926b..6fe9c86b3a 100644 --- a/subprojects/gst-plugins-base/sys/ximage/ximage.c +++ b/subprojects/gst-plugins-base/sys/ximage/ximage.c @@ -27,6 +27,9 @@ static gboolean plugin_init (GstPlugin * plugin) { + if (g_getenv ("GST_XINITTHREADS")) + XInitThreads (); + return GST_ELEMENT_REGISTER (ximagesink, plugin); } diff --git a/subprojects/gst-plugins-base/sys/xvimage/xvimage.c b/subprojects/gst-plugins-base/sys/xvimage/xvimage.c index 837306e65e..8b50f69ca0 100644 --- a/subprojects/gst-plugins-base/sys/xvimage/xvimage.c +++ b/subprojects/gst-plugins-base/sys/xvimage/xvimage.c @@ -27,6 +27,9 @@ static gboolean plugin_init (GstPlugin * plugin) { + if (g_getenv ("GST_XINITTHREADS")) + XInitThreads (); + return GST_ELEMENT_REGISTER (xvimagesink, plugin);; } diff --git a/subprojects/gst-plugins-base/tests/check/elements/glfilter.c b/subprojects/gst-plugins-base/tests/check/elements/glfilter.c index a71120e350..7af3caf407 100644 --- a/subprojects/gst-plugins-base/tests/check/elements/glfilter.c +++ b/subprojects/gst-plugins-base/tests/check/elements/glfilter.c @@ -125,6 +125,7 @@ main (int argc, char **argv) { Suite *s; g_setenv ("GST_GL_XINITTHREADS", "1", TRUE); + g_setenv ("GST_XINITTHREADS", "1", TRUE); gst_check_init (&argc, &argv); s = glfilter_suite (); return gst_check_run_suite (s, "glfilter", __FILE__); diff --git a/subprojects/gst-plugins-base/tests/check/elements/glimagesink.c b/subprojects/gst-plugins-base/tests/check/elements/glimagesink.c index 90490f50b7..67a67c7db5 100644 --- a/subprojects/gst-plugins-base/tests/check/elements/glimagesink.c +++ b/subprojects/gst-plugins-base/tests/check/elements/glimagesink.c @@ -277,6 +277,7 @@ main (int argc, char **argv) { Suite *s; g_setenv ("GST_GL_XINITTHREADS", "1", TRUE); + g_setenv ("GST_XINITTHREADS", "1", TRUE); gst_check_init (&argc, &argv); s = glimagesink_suite (); return gst_check_run_suite (s, "glimagesink", __FILE__); diff --git a/subprojects/gst-plugins-base/tests/check/elements/glmixer.c b/subprojects/gst-plugins-base/tests/check/elements/glmixer.c index a1c44e86f2..56d6e46db0 100644 --- a/subprojects/gst-plugins-base/tests/check/elements/glmixer.c +++ b/subprojects/gst-plugins-base/tests/check/elements/glmixer.c @@ -144,6 +144,7 @@ main (int argc, char **argv) { Suite *s; g_setenv ("GST_GL_XINITTHREADS", "1", TRUE); + g_setenv ("GST_XINITTHREADS", "1", TRUE); gst_check_init (&argc, &argv); s = glmixer_suite (); return gst_check_run_suite (s, "glmixer", __FILE__); diff --git a/subprojects/gst-plugins-base/tests/check/elements/glstereo.c b/subprojects/gst-plugins-base/tests/check/elements/glstereo.c index fbf568e590..2ae05c00ab 100644 --- a/subprojects/gst-plugins-base/tests/check/elements/glstereo.c +++ b/subprojects/gst-plugins-base/tests/check/elements/glstereo.c @@ -70,6 +70,7 @@ main (int argc, char **argv) { Suite *s; g_setenv ("GST_GL_XINITTHREADS", "1", TRUE); + g_setenv ("GST_XINITTHREADS", "1", TRUE); gst_check_init (&argc, &argv); s = glstereo_suite (); return gst_check_run_suite (s, "glstereo", __FILE__); diff --git a/subprojects/gst-plugins-base/tools/gst-play.c b/subprojects/gst-plugins-base/tools/gst-play.c index da6dfec46d..d8702b957a 100644 --- a/subprojects/gst-plugins-base/tools/gst-play.c +++ b/subprojects/gst-plugins-base/tools/gst-play.c @@ -1659,6 +1659,7 @@ main (int argc, char **argv) g_set_prgname ("gst-play-" GST_API_VERSION); /* Ensure XInitThreads() is called if/when needed */ g_setenv ("GST_GL_XINITTHREADS", "1", TRUE); + g_setenv ("GST_XINITTHREADS", "1", TRUE); ctx = g_option_context_new ("FILE1|URI1 [FILE2|URI2] [FILE3|URI3] ..."); g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE); diff --git a/subprojects/gstreamer/tools/gst-launch.c b/subprojects/gstreamer/tools/gst-launch.c index d38ea9f612..2a3bf4bc7b 100644 --- a/subprojects/gstreamer/tools/gst-launch.c +++ b/subprojects/gstreamer/tools/gst-launch.c @@ -1149,6 +1149,7 @@ main (int argc, char *argv[]) g_set_prgname ("gst-launch-" GST_API_VERSION); /* Ensure XInitThreads() is called if/when needed */ g_setenv ("GST_GL_XINITTHREADS", "1", TRUE); + g_setenv ("GST_XINITTHREADS", "1", TRUE); #ifndef GST_DISABLE_OPTION_PARSING ctx = g_option_context_new ("PIPELINE-DESCRIPTION");