ximagesink/xvimagesink: use GST_XINITTHREADS to ensure call to XInitThreads

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2098>
This commit is contained in:
Haihua Hu 2022-04-01 21:47:59 +08:00
parent 1842ffc906
commit df0958e855
10 changed files with 15 additions and 1 deletions

View file

@ -933,6 +933,8 @@ class GstValidateTest(Test):
# Ensure XInitThreads is called, see bgo#731525 # Ensure XInitThreads is called, see bgo#731525
subproc_env['GST_GL_XINITTHREADS'] = '1' subproc_env['GST_GL_XINITTHREADS'] = '1'
self.add_env_variable('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: if self.scenario is not None:
scenario = self.scenario.get_execution_name() scenario = self.scenario.get_execution_name()

View file

@ -62,7 +62,7 @@ gl_element_init (GstPlugin * plugin)
#endif #endif
#if GST_GL_HAVE_WINDOW_X11 #if GST_GL_HAVE_WINDOW_X11
if (g_getenv ("GST_GL_XINITTHREADS")) if (g_getenv ("GST_GL_XINITTHREADS") || g_getenv ("GST_XINITTHREADS"))
XInitThreads (); XInitThreads ();
#endif #endif
g_once_init_leave (&res, TRUE); g_once_init_leave (&res, TRUE);

View file

@ -27,6 +27,9 @@
static gboolean static gboolean
plugin_init (GstPlugin * plugin) plugin_init (GstPlugin * plugin)
{ {
if (g_getenv ("GST_XINITTHREADS"))
XInitThreads ();
return GST_ELEMENT_REGISTER (ximagesink, plugin); return GST_ELEMENT_REGISTER (ximagesink, plugin);
} }

View file

@ -27,6 +27,9 @@
static gboolean static gboolean
plugin_init (GstPlugin * plugin) plugin_init (GstPlugin * plugin)
{ {
if (g_getenv ("GST_XINITTHREADS"))
XInitThreads ();
return GST_ELEMENT_REGISTER (xvimagesink, plugin);; return GST_ELEMENT_REGISTER (xvimagesink, plugin);;
} }

View file

@ -125,6 +125,7 @@ main (int argc, char **argv)
{ {
Suite *s; Suite *s;
g_setenv ("GST_GL_XINITTHREADS", "1", TRUE); g_setenv ("GST_GL_XINITTHREADS", "1", TRUE);
g_setenv ("GST_XINITTHREADS", "1", TRUE);
gst_check_init (&argc, &argv); gst_check_init (&argc, &argv);
s = glfilter_suite (); s = glfilter_suite ();
return gst_check_run_suite (s, "glfilter", __FILE__); return gst_check_run_suite (s, "glfilter", __FILE__);

View file

@ -277,6 +277,7 @@ main (int argc, char **argv)
{ {
Suite *s; Suite *s;
g_setenv ("GST_GL_XINITTHREADS", "1", TRUE); g_setenv ("GST_GL_XINITTHREADS", "1", TRUE);
g_setenv ("GST_XINITTHREADS", "1", TRUE);
gst_check_init (&argc, &argv); gst_check_init (&argc, &argv);
s = glimagesink_suite (); s = glimagesink_suite ();
return gst_check_run_suite (s, "glimagesink", __FILE__); return gst_check_run_suite (s, "glimagesink", __FILE__);

View file

@ -144,6 +144,7 @@ main (int argc, char **argv)
{ {
Suite *s; Suite *s;
g_setenv ("GST_GL_XINITTHREADS", "1", TRUE); g_setenv ("GST_GL_XINITTHREADS", "1", TRUE);
g_setenv ("GST_XINITTHREADS", "1", TRUE);
gst_check_init (&argc, &argv); gst_check_init (&argc, &argv);
s = glmixer_suite (); s = glmixer_suite ();
return gst_check_run_suite (s, "glmixer", __FILE__); return gst_check_run_suite (s, "glmixer", __FILE__);

View file

@ -70,6 +70,7 @@ main (int argc, char **argv)
{ {
Suite *s; Suite *s;
g_setenv ("GST_GL_XINITTHREADS", "1", TRUE); g_setenv ("GST_GL_XINITTHREADS", "1", TRUE);
g_setenv ("GST_XINITTHREADS", "1", TRUE);
gst_check_init (&argc, &argv); gst_check_init (&argc, &argv);
s = glstereo_suite (); s = glstereo_suite ();
return gst_check_run_suite (s, "glstereo", __FILE__); return gst_check_run_suite (s, "glstereo", __FILE__);

View file

@ -1659,6 +1659,7 @@ main (int argc, char **argv)
g_set_prgname ("gst-play-" GST_API_VERSION); g_set_prgname ("gst-play-" GST_API_VERSION);
/* Ensure XInitThreads() is called if/when needed */ /* Ensure XInitThreads() is called if/when needed */
g_setenv ("GST_GL_XINITTHREADS", "1", TRUE); g_setenv ("GST_GL_XINITTHREADS", "1", TRUE);
g_setenv ("GST_XINITTHREADS", "1", TRUE);
ctx = g_option_context_new ("FILE1|URI1 [FILE2|URI2] [FILE3|URI3] ..."); ctx = g_option_context_new ("FILE1|URI1 [FILE2|URI2] [FILE3|URI3] ...");
g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE); g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE);

View file

@ -1149,6 +1149,7 @@ main (int argc, char *argv[])
g_set_prgname ("gst-launch-" GST_API_VERSION); g_set_prgname ("gst-launch-" GST_API_VERSION);
/* Ensure XInitThreads() is called if/when needed */ /* Ensure XInitThreads() is called if/when needed */
g_setenv ("GST_GL_XINITTHREADS", "1", TRUE); g_setenv ("GST_GL_XINITTHREADS", "1", TRUE);
g_setenv ("GST_XINITTHREADS", "1", TRUE);
#ifndef GST_DISABLE_OPTION_PARSING #ifndef GST_DISABLE_OPTION_PARSING
ctx = g_option_context_new ("PIPELINE-DESCRIPTION"); ctx = g_option_context_new ("PIPELINE-DESCRIPTION");