composition: Start kindergarten task when going to READY.

And stop it when going back to NULL.

Update tests.

Co-Authored by: Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>
This commit is contained in:
Thibault Saunier 2014-07-11 21:59:43 +02:00
parent 95a2e3b570
commit c94dfdc688
5 changed files with 27 additions and 4 deletions

View file

@ -879,8 +879,6 @@ gnl_composition_init (GnlComposition * comp)
priv->gnl_event_pad_func = GST_PAD_EVENTFUNC (GNL_OBJECT_SRC (comp)); priv->gnl_event_pad_func = GST_PAD_EVENTFUNC (GNL_OBJECT_SRC (comp));
gst_pad_set_event_function (GNL_OBJECT_SRC (comp), gst_pad_set_event_function (GNL_OBJECT_SRC (comp),
GST_DEBUG_FUNCPTR (gnl_composition_event_handler)); GST_DEBUG_FUNCPTR (gnl_composition_event_handler));
_start_task (comp);
} }
static void static void
@ -947,8 +945,6 @@ gnl_composition_finalize (GObject * object)
g_mutex_clear (&priv->objects_lock); g_mutex_clear (&priv->objects_lock);
g_mutex_clear (&priv->flushing_lock); g_mutex_clear (&priv->flushing_lock);
g_mutex_clear (&priv->pending_io_lock); g_mutex_clear (&priv->pending_io_lock);
_stop_task (comp);
g_rec_mutex_clear (&comp->task_rec_lock); g_rec_mutex_clear (&comp->task_rec_lock);
G_OBJECT_CLASS (parent_class)->finalize (object); 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))); gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
_start_task (comp);
break;
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
gnl_composition_reset (comp); gnl_composition_reset (comp);
@ -2465,6 +2464,7 @@ gnl_composition_change_state (GstElement * element, GstStateChange transition)
gnl_composition_reset (comp); gnl_composition_reset (comp);
break; break;
case GST_STATE_CHANGE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
_stop_task (comp);
_set_all_children_state (comp, GST_STATE_NULL); _set_all_children_state (comp, GST_STATE_NULL);
gnl_composition_reset (comp); gnl_composition_reset (comp);
break; break;

View file

@ -152,6 +152,7 @@ GST_START_TEST (test_one_space_another)
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
fail_if (comp == NULL); fail_if (comp == NULL);
/* TOPOLOGY /* TOPOLOGY
@ -230,6 +231,7 @@ GST_START_TEST (test_one_default_another)
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
fail_if (comp == NULL); fail_if (comp == NULL);
/* TOPOLOGY /* TOPOLOGY
@ -346,6 +348,7 @@ GST_START_TEST (test_one_expandable_another)
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
fail_if (comp == NULL); fail_if (comp == NULL);
/* TOPOLOGY /* TOPOLOGY
@ -477,6 +480,7 @@ GST_START_TEST (test_renegotiation)
pipeline = gst_pipeline_new ("test_pipeline"); pipeline = gst_pipeline_new ("test_pipeline");
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
fail_if (comp == NULL); fail_if (comp == NULL);
/* /*
@ -682,6 +686,7 @@ GST_START_TEST (test_one_bin_space_another)
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
fail_if (comp == NULL); fail_if (comp == NULL);
/* /*
@ -750,6 +755,7 @@ GST_START_TEST (test_one_above_another)
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
fail_if (comp == NULL); fail_if (comp == NULL);
/* /*

View file

@ -49,6 +49,8 @@ GST_START_TEST (test_change_object_start_stop_in_current_stack)
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); 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"); sink = gst_element_factory_make_or_warn ("fakesink", "sink");
gst_bin_add_many (GST_BIN (pipeline), comp, sink, NULL); 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_BIN (gst_element_factory_make ("gnlcomposition",
"composition")); "composition"));
gst_element_set_state (GST_ELEMENT (composition), GST_STATE_READY);
source1 = gst_element_factory_make ("gnlsource", "source1"); source1 = gst_element_factory_make ("gnlsource", "source1");
source2 = gst_element_factory_make ("gnlsource", "source2"); 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); GST_ERROR ("Pipeline refcounts: %i", ((GObject *) pipeline)->ref_count);
composition = gst_element_factory_make ("gnlcomposition", "composition"); composition = gst_element_factory_make ("gnlcomposition", "composition");
gst_element_set_state (composition, GST_STATE_READY);
fakesink = gst_element_factory_make ("fakesink", NULL); fakesink = gst_element_factory_make ("fakesink", NULL);
/* gnl_adder */ /* gnl_adder */

View file

@ -132,6 +132,7 @@ GST_START_TEST (test_simple_operation)
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
/* TOPOLOGY /* TOPOLOGY
* *
@ -219,6 +220,7 @@ GST_START_TEST (test_pyramid_operations)
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
/* /*
source source
@ -310,6 +312,7 @@ GST_START_TEST (test_pyramid_operations2)
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
/* /*
source1 source1
@ -406,6 +409,7 @@ GST_START_TEST (test_pyramid_operations_expandable)
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
/* /*
source1 source1
@ -490,6 +494,7 @@ GST_START_TEST (test_complex_operations)
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
/* TOPOLOGY /* TOPOLOGY
* *
@ -580,6 +585,7 @@ GST_START_TEST (test_complex_operations_bis)
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
/* TOPOLOGY /* TOPOLOGY
* *

View file

@ -13,6 +13,7 @@ test_simplest_full (void)
pipeline = gst_pipeline_new ("test_pipeline"); pipeline = gst_pipeline_new ("test_pipeline");
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
fail_if (comp == NULL); fail_if (comp == NULL);
/* /*
@ -116,6 +117,7 @@ test_time_duration_full (void)
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
/* /*
Source 1 Source 1
@ -182,6 +184,7 @@ test_time_duration_full (void)
ASSERT_OBJECT_REFCOUNT (source1, "source1", 1); ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
gst_element_set_state (comp, GST_STATE_NULL);
gst_object_unref (comp); gst_object_unref (comp);
} }
@ -201,6 +204,7 @@ test_one_after_other_full (void)
pipeline = gst_pipeline_new ("test_pipeline"); pipeline = gst_pipeline_new ("test_pipeline");
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
fail_if (comp == NULL); fail_if (comp == NULL);
/* /*
@ -388,6 +392,7 @@ test_one_under_another_full (void)
pipeline = gst_pipeline_new ("test_pipeline"); pipeline = gst_pipeline_new ("test_pipeline");
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
fail_if (comp == NULL); fail_if (comp == NULL);
/* TOPOLOGY /* TOPOLOGY
@ -530,6 +535,7 @@ test_one_bin_after_other_full (void)
pipeline = gst_pipeline_new ("test_pipeline"); pipeline = gst_pipeline_new ("test_pipeline");
comp = comp =
gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
gst_element_set_state (comp, GST_STATE_READY);
fail_if (comp == NULL); fail_if (comp == NULL);
/* /*