diff --git a/subprojects/gst-editing-services/tests/check/nle/nlesource.c b/subprojects/gst-editing-services/tests/check/nle/nlesource.c index 3782b7cbc4..51b0d44e69 100644 --- a/subprojects/gst-editing-services/tests/check/nle/nlesource.c +++ b/subprojects/gst-editing-services/tests/check/nle/nlesource.c @@ -10,6 +10,8 @@ GST_START_TEST (test_simple_videotestsrc) gboolean carry_on = TRUE; GstPad *sinkpad; + ges_init (); + pipeline = gst_pipeline_new ("test_pipeline"); /* @@ -98,6 +100,8 @@ GST_START_TEST (test_simple_videotestsrc) gst_object_unref (bus); g_free (collect); + + ges_deinit (); } GST_END_TEST; @@ -112,6 +116,8 @@ GST_START_TEST (test_videotestsrc_in_bin) gboolean carry_on = TRUE; GstPad *sinkpad; + ges_init (); + pipeline = gst_pipeline_new ("test_pipeline"); /* @@ -198,6 +204,8 @@ GST_START_TEST (test_videotestsrc_in_bin) gst_object_unref (bus); g_free (collect); + + ges_deinit (); } GST_END_TEST; @@ -208,7 +216,6 @@ gnonlin_suite (void) Suite *s = suite_create ("nlesource"); TCase *tc_chain = tcase_create ("nlesource"); - ges_init (); suite_add_tcase (s, tc_chain); if (0) diff --git a/subprojects/gst-editing-services/tests/check/nle/seek.c b/subprojects/gst-editing-services/tests/check/nle/seek.c index 84c460c853..e221d81b2f 100644 --- a/subprojects/gst-editing-services/tests/check/nle/seek.c +++ b/subprojects/gst-editing-services/tests/check/nle/seek.c @@ -1,6 +1,8 @@ #include "common.h" static const gchar *compositor_element = NULL; +static void late_ges_init (void); + typedef struct _SeekInfo { GstClockTime position; /* Seek value and segment position */ @@ -476,6 +478,8 @@ GST_START_TEST (test_complex_operations) GstElement *comp, *oper, *source1, *source2; GList *segments = NULL, *seeks = NULL; + late_ges_init (); + comp = gst_element_factory_make_or_warn ("nlecomposition", "test_composition"); @@ -593,6 +597,8 @@ GST_START_TEST (test_complex_operations_bis) GstElement *comp, *oper, *source1, *source2; GList *segments = NULL, *seeks = NULL; + late_ges_init (); + comp = gst_element_factory_make_or_warn ("nlecomposition", "test_composition"); @@ -715,6 +721,8 @@ GST_END_TEST; GST_START_TEST (test_simplest) { + late_ges_init (); + test_simplest_full (); } @@ -723,6 +731,8 @@ GST_END_TEST; GST_START_TEST (test_one_after_other) { + late_ges_init (); + test_one_after_other_full (); } @@ -731,6 +741,8 @@ GST_END_TEST; GST_START_TEST (test_one_under_another) { + late_ges_init (); + test_one_under_another_full (); } @@ -739,11 +751,26 @@ GST_END_TEST; GST_START_TEST (test_one_bin_after_other) { + late_ges_init (); + test_one_bin_after_other_full (); } GST_END_TEST; +static void +late_ges_init () +{ + /* We need to do this inside the test cases, not during the initialization + * of the suite, as ges_init() will initialize thread pools, which cannot + * work properly after a fork. */ + + if (atexit (ges_deinit) != 0) { + GST_ERROR ("failed to set ges_deinit as exit function"); + } + + ges_init (); +} static Suite * gnonlin_suite (void) @@ -751,7 +778,6 @@ gnonlin_suite (void) Suite *s = suite_create ("gnonlin-seek"); TCase *tc_chain = tcase_create ("general"); - ges_init (); suite_add_tcase (s, tc_chain); if (gst_registry_check_feature_version (gst_registry_get (), "compositor", 1, diff --git a/subprojects/gst-editing-services/tests/check/nle/tempochange.c b/subprojects/gst-editing-services/tests/check/nle/tempochange.c index 0454f5cc26..d9226fc10b 100644 --- a/subprojects/gst-editing-services/tests/check/nle/tempochange.c +++ b/subprojects/gst-editing-services/tests/check/nle/tempochange.c @@ -20,6 +20,8 @@ #include "common.h" #include "plugins/nle/nleobject.h" +static void late_ges_init (void); + typedef struct _PadEventData { gchar *name; @@ -386,6 +388,8 @@ GST_START_TEST (test_tempochange_play) gdouble rates[3] = { 0.5, 4.0, 1.0 }; guint i, j; + late_ges_init (); + for (i = 0; i < G_N_ELEMENTS (rates); i++) { gdouble rate = rates[i]; GST_DEBUG ("rate = %g", rate); @@ -517,6 +521,8 @@ GST_START_TEST (test_tempochange_seek) guint i, j; GstClockTime offset = 0.1 * GST_SECOND; + late_ges_init (); + for (i = 0; i < G_N_ELEMENTS (rates); i++) { gdouble rate = rates[i]; GST_DEBUG ("rate = %g", rate); @@ -629,17 +635,26 @@ GST_START_TEST (test_tempochange_seek) GST_END_TEST; -static Suite * -gnonlin_suite (void) +static void +late_ges_init () { - Suite *s = suite_create ("nle"); - TCase *tc_chain = tcase_create ("tempochange"); + /* We need to do this inside the test cases, not during the initialization + * of the suite, as ges_init() will initialize thread pools, which cannot + * work properly after a fork. */ if (atexit (ges_deinit) != 0) { GST_ERROR ("failed to set ges_deinit as exit function"); } ges_init (); +} + +static Suite * +gnonlin_suite (void) +{ + Suite *s = suite_create ("nle"); + TCase *tc_chain = tcase_create ("tempochange"); + suite_add_tcase (s, tc_chain); /* give the tests a little more time than the default