From c94dfdc68852fe1d5be307238f03885654d95b5c Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 11 Jul 2014 21:59:43 +0200 Subject: [PATCH] composition: Start kindergarten task when going to READY. And stop it when going back to NULL. Update tests. Co-Authored by: Mathieu Duponchelle --- gnl/gnlcomposition.c | 8 ++++---- tests/check/gnl/complex.c | 6 ++++++ tests/check/gnl/gnlcomposition.c | 5 +++++ tests/check/gnl/gnloperation.c | 6 ++++++ tests/check/gnl/simple.c | 6 ++++++ 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/gnl/gnlcomposition.c b/gnl/gnlcomposition.c index 55dd3be..d0ece2b 100644 --- a/gnl/gnlcomposition.c +++ b/gnl/gnlcomposition.c @@ -879,8 +879,6 @@ gnl_composition_init (GnlComposition * comp) priv->gnl_event_pad_func = GST_PAD_EVENTFUNC (GNL_OBJECT_SRC (comp)); gst_pad_set_event_function (GNL_OBJECT_SRC (comp), GST_DEBUG_FUNCPTR (gnl_composition_event_handler)); - - _start_task (comp); } static void @@ -947,8 +945,6 @@ gnl_composition_finalize (GObject * object) g_mutex_clear (&priv->objects_lock); g_mutex_clear (&priv->flushing_lock); g_mutex_clear (&priv->pending_io_lock); - - _stop_task (comp); g_rec_mutex_clear (&comp->task_rec_lock); G_OBJECT_CLASS (parent_class)->finalize (object); @@ -2429,6 +2425,9 @@ gnl_composition_change_state (GstElement * element, GstStateChange transition) gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition))); switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: + _start_task (comp); + break; case GST_STATE_CHANGE_READY_TO_PAUSED: gnl_composition_reset (comp); @@ -2465,6 +2464,7 @@ gnl_composition_change_state (GstElement * element, GstStateChange transition) gnl_composition_reset (comp); break; case GST_STATE_CHANGE_READY_TO_NULL: + _stop_task (comp); _set_all_children_state (comp, GST_STATE_NULL); gnl_composition_reset (comp); break; diff --git a/tests/check/gnl/complex.c b/tests/check/gnl/complex.c index 16d69b0..1c05faf 100644 --- a/tests/check/gnl/complex.c +++ b/tests/check/gnl/complex.c @@ -152,6 +152,7 @@ GST_START_TEST (test_one_space_another) comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); fail_if (comp == NULL); /* TOPOLOGY @@ -230,6 +231,7 @@ GST_START_TEST (test_one_default_another) comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); fail_if (comp == NULL); /* TOPOLOGY @@ -346,6 +348,7 @@ GST_START_TEST (test_one_expandable_another) comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); fail_if (comp == NULL); /* TOPOLOGY @@ -477,6 +480,7 @@ GST_START_TEST (test_renegotiation) pipeline = gst_pipeline_new ("test_pipeline"); comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); fail_if (comp == NULL); /* @@ -682,6 +686,7 @@ GST_START_TEST (test_one_bin_space_another) comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); fail_if (comp == NULL); /* @@ -750,6 +755,7 @@ GST_START_TEST (test_one_above_another) comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); fail_if (comp == NULL); /* diff --git a/tests/check/gnl/gnlcomposition.c b/tests/check/gnl/gnlcomposition.c index 595b3c3..b84fae1 100644 --- a/tests/check/gnl/gnlcomposition.c +++ b/tests/check/gnl/gnlcomposition.c @@ -49,6 +49,8 @@ GST_START_TEST (test_change_object_start_stop_in_current_stack) comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); + sink = gst_element_factory_make_or_warn ("fakesink", "sink"); gst_bin_add_many (GST_BIN (pipeline), comp, sink, NULL); @@ -177,6 +179,8 @@ GST_START_TEST (test_remove_invalid_object) composition = GST_BIN (gst_element_factory_make ("gnlcomposition", "composition")); + gst_element_set_state (GST_ELEMENT (composition), GST_STATE_READY); + source1 = gst_element_factory_make ("gnlsource", "source1"); source2 = gst_element_factory_make ("gnlsource", "source2"); @@ -242,6 +246,7 @@ GST_START_TEST (test_simple_adder) GST_ERROR ("Pipeline refcounts: %i", ((GObject *) pipeline)->ref_count); composition = gst_element_factory_make ("gnlcomposition", "composition"); + gst_element_set_state (composition, GST_STATE_READY); fakesink = gst_element_factory_make ("fakesink", NULL); /* gnl_adder */ diff --git a/tests/check/gnl/gnloperation.c b/tests/check/gnl/gnloperation.c index 86e0408..86354f1 100644 --- a/tests/check/gnl/gnloperation.c +++ b/tests/check/gnl/gnloperation.c @@ -132,6 +132,7 @@ GST_START_TEST (test_simple_operation) comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); /* TOPOLOGY * @@ -219,6 +220,7 @@ GST_START_TEST (test_pyramid_operations) comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); /* source @@ -310,6 +312,7 @@ GST_START_TEST (test_pyramid_operations2) comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); /* source1 @@ -406,6 +409,7 @@ GST_START_TEST (test_pyramid_operations_expandable) comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); /* source1 @@ -490,6 +494,7 @@ GST_START_TEST (test_complex_operations) comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); /* TOPOLOGY * @@ -580,6 +585,7 @@ GST_START_TEST (test_complex_operations_bis) comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); /* TOPOLOGY * diff --git a/tests/check/gnl/simple.c b/tests/check/gnl/simple.c index d8e0a96..04b7012 100644 --- a/tests/check/gnl/simple.c +++ b/tests/check/gnl/simple.c @@ -13,6 +13,7 @@ test_simplest_full (void) pipeline = gst_pipeline_new ("test_pipeline"); comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); fail_if (comp == NULL); /* @@ -116,6 +117,7 @@ test_time_duration_full (void) comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); /* Source 1 @@ -182,6 +184,7 @@ test_time_duration_full (void) ASSERT_OBJECT_REFCOUNT (source1, "source1", 1); + gst_element_set_state (comp, GST_STATE_NULL); gst_object_unref (comp); } @@ -201,6 +204,7 @@ test_one_after_other_full (void) pipeline = gst_pipeline_new ("test_pipeline"); comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); fail_if (comp == NULL); /* @@ -388,6 +392,7 @@ test_one_under_another_full (void) pipeline = gst_pipeline_new ("test_pipeline"); comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); fail_if (comp == NULL); /* TOPOLOGY @@ -530,6 +535,7 @@ test_one_bin_after_other_full (void) pipeline = gst_pipeline_new ("test_pipeline"); comp = gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); + gst_element_set_state (comp, GST_STATE_READY); fail_if (comp == NULL); /* -- 2.7.4