Finish fixing tests

This commit is contained in:
Thibault Saunier 2014-06-29 22:35:34 +02:00
parent ab1d577a10
commit 3c958af13c
3 changed files with 32 additions and 26 deletions

View file

@ -200,7 +200,7 @@ static void
compare_relink_single_node (GnlComposition * comp, GNode * node, compare_relink_single_node (GnlComposition * comp, GNode * node,
GNode * oldstack); GNode * oldstack);
static gboolean update_pipeline_func (GnlComposition * comp); static gboolean update_pipeline_func (GnlComposition * comp);
static gboolean commit_pipeline_func (GnlComposition *comp); static gboolean commit_pipeline_func (GnlComposition * comp);
/* COMP_REAL_START: actual position to start current playback at. */ /* COMP_REAL_START: actual position to start current playback at. */
@ -309,7 +309,8 @@ _start_task (GnlComposition * comp)
task = comp->task; task = comp->task;
if (task == NULL) { if (task == NULL) {
task = gst_task_new ((GstTaskFunction) iterate_main_context_func, comp, NULL); task =
gst_task_new ((GstTaskFunction) iterate_main_context_func, comp, NULL);
gst_task_set_lock (task, GET_TASK_LOCK (comp)); gst_task_set_lock (task, GET_TASK_LOCK (comp));
GST_INFO_OBJECT (comp, "created task %p", task); GST_INFO_OBJECT (comp, "created task %p", task);
comp->task = task; comp->task = task;
@ -482,9 +483,10 @@ gnl_composition_class_init (GnlCompositionClass * klass)
G_STRUCT_OFFSET (GnlObjectClass, commit_signal_handler), NULL, NULL, NULL, G_STRUCT_OFFSET (GnlObjectClass, commit_signal_handler), NULL, NULL, NULL,
G_TYPE_BOOLEAN, 1, G_TYPE_BOOLEAN); G_TYPE_BOOLEAN, 1, G_TYPE_BOOLEAN);
_signals[COMMITED_SIGNAL] = g_signal_new ("commited", G_TYPE_FROM_CLASS (klass), _signals[COMMITED_SIGNAL] =
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic, g_signal_new ("commited", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN); 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 1,
G_TYPE_BOOLEAN);
gnlobject_class->commit = gnl_composition_commit_func; gnlobject_class->commit = gnl_composition_commit_func;
} }
@ -1861,7 +1863,7 @@ set_child_caps (GValue * item, GValue * ret G_GNUC_UNUSED, GnlObject * comp)
} }
static gboolean static gboolean
commit_pipeline_func (GnlComposition *comp) commit_pipeline_func (GnlComposition * comp)
{ {
GList *tmp; GList *tmp;
gboolean commited = FALSE; gboolean commited = FALSE;
@ -1890,8 +1892,12 @@ commit_pipeline_func (GnlComposition *comp)
priv->objects_stop = g_list_sort priv->objects_stop = g_list_sort
(priv->objects_stop, (GCompareFunc) objects_stop_compare); (priv->objects_stop, (GCompareFunc) objects_stop_compare);
/* And update the pipeline at current position if needed */ if (GST_STATE (comp) < GST_STATE_PAUSED) {
update_pipeline_at_current_position (comp); update_start_stop_duration (comp);
} else {
/* And update the pipeline at current position if needed */
update_pipeline_at_current_position (comp);
}
COMP_OBJECTS_UNLOCK (comp); COMP_OBJECTS_UNLOCK (comp);
GST_ERROR ("emitted signal"); GST_ERROR ("emitted signal");
@ -1935,7 +1941,7 @@ update_pipeline_func (GnlComposition * comp)
GST_TIME_ARGS (epos)); GST_TIME_ARGS (epos));
gst_element_post_message (GST_ELEMENT_CAST (comp), gst_element_post_message (GST_ELEMENT_CAST (comp),
gst_message_new_segment_done (GST_OBJECT (comp), gst_message_new_segment_done (GST_OBJECT (comp),
priv->segment->format, epos)); priv->segment->format, epos));
gst_pad_push_event (GNL_OBJECT (comp)->srcpad, gst_pad_push_event (GNL_OBJECT (comp)->srcpad,
gst_event_new_segment_done (priv->segment->format, epos)); gst_event_new_segment_done (priv->segment->format, epos));
} }

View file

@ -252,9 +252,9 @@ GST_START_TEST (test_simple_adder)
fail_unless (gst_bin_add (GST_BIN (composition), gnlsource2)); fail_unless (gst_bin_add (GST_BIN (composition), gnlsource2));
fail_unless (gst_element_link (composition, fakesink) == TRUE); fail_unless (gst_element_link (composition, fakesink) == TRUE);
GST_DEBUG ("Setting pipeline to PAUSED"); GST_DEBUG ("Setting pipeline to PLAYING");
g_signal_emit_by_name (composition, "commit", TRUE, &ret); commit_and_wait (composition, &ret);
fail_if (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING) fail_if (gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING)
== GST_STATE_CHANGE_FAILURE); == GST_STATE_CHANGE_FAILURE);

View file

@ -166,7 +166,7 @@ GST_START_TEST (test_simple_operation)
ASSERT_OBJECT_REFCOUNT (oper, "oper", 1); ASSERT_OBJECT_REFCOUNT (oper, "oper", 1);
gst_bin_add (GST_BIN (comp), source); gst_bin_add (GST_BIN (comp), source);
g_signal_emit_by_name (comp, "commit", TRUE, &ret); commit_and_wait (comp, &ret);
check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND); check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source, "source", 1); ASSERT_OBJECT_REFCOUNT (source, "source", 1);
@ -174,7 +174,7 @@ GST_START_TEST (test_simple_operation)
/* Add operaton */ /* Add operaton */
gst_bin_add (GST_BIN (comp), oper); gst_bin_add (GST_BIN (comp), oper);
g_signal_emit_by_name (comp, "commit", TRUE, &ret); commit_and_wait (comp, &ret);
check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND); check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (oper, "oper", 1); ASSERT_OBJECT_REFCOUNT (oper, "oper", 1);
@ -190,7 +190,7 @@ GST_START_TEST (test_simple_operation)
/* re-add source */ /* re-add source */
gst_bin_add (GST_BIN (comp), source); gst_bin_add (GST_BIN (comp), source);
g_signal_emit_by_name (comp, "commit", TRUE, &ret); commit_and_wait (comp, &ret);
check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND); check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND);
gst_object_unref (source); gst_object_unref (source);
@ -255,7 +255,7 @@ GST_START_TEST (test_pyramid_operations)
ASSERT_OBJECT_REFCOUNT (oper2, "oper2", 1); ASSERT_OBJECT_REFCOUNT (oper2, "oper2", 1);
gst_bin_add (GST_BIN (comp), source); gst_bin_add (GST_BIN (comp), source);
g_signal_emit_by_name (comp, "commit", TRUE, &ret); commit_and_wait (comp, &ret);
check_start_stop_duration (source, 0, 10 * GST_SECOND, 10 * GST_SECOND); check_start_stop_duration (source, 0, 10 * GST_SECOND, 10 * GST_SECOND);
check_start_stop_duration (comp, 0, 10 * GST_SECOND, 10 * GST_SECOND); check_start_stop_duration (comp, 0, 10 * GST_SECOND, 10 * GST_SECOND);
@ -264,7 +264,7 @@ GST_START_TEST (test_pyramid_operations)
/* Add operation 1 */ /* Add operation 1 */
gst_bin_add (GST_BIN (comp), oper1); gst_bin_add (GST_BIN (comp), oper1);
g_signal_emit_by_name (comp, "commit", TRUE, &ret); commit_and_wait (comp, &ret);
check_start_stop_duration (oper1, 4 * GST_SECOND, 6 * GST_SECOND, check_start_stop_duration (oper1, 4 * GST_SECOND, 6 * GST_SECOND,
2 * GST_SECOND); 2 * GST_SECOND);
check_start_stop_duration (comp, 0, 10 * GST_SECOND, 10 * GST_SECOND); check_start_stop_duration (comp, 0, 10 * GST_SECOND, 10 * GST_SECOND);
@ -274,7 +274,7 @@ GST_START_TEST (test_pyramid_operations)
/* Add operation 2 */ /* Add operation 2 */
gst_bin_add (GST_BIN (comp), oper2); gst_bin_add (GST_BIN (comp), oper2);
g_signal_emit_by_name (comp, "commit", TRUE, &ret); commit_and_wait (comp, &ret);
check_start_stop_duration (oper2, 2 * GST_SECOND, 8 * GST_SECOND, check_start_stop_duration (oper2, 2 * GST_SECOND, 8 * GST_SECOND,
6 * GST_SECOND); 6 * GST_SECOND);
check_start_stop_duration (comp, 0, 10 * GST_SECOND, 10 * GST_SECOND); check_start_stop_duration (comp, 0, 10 * GST_SECOND, 10 * GST_SECOND);
@ -355,25 +355,25 @@ GST_START_TEST (test_pyramid_operations2)
/* Add source 1 */ /* Add source 1 */
gst_bin_add (GST_BIN (comp), source1); gst_bin_add (GST_BIN (comp), source1);
g_signal_emit_by_name (comp, "commit", TRUE, &ret); commit_and_wait (comp, &ret);
check_start_stop_duration (comp, 0, 2 * GST_SECOND, 2 * GST_SECOND); check_start_stop_duration (comp, 0, 2 * GST_SECOND, 2 * GST_SECOND);
/* Add source 2 */ /* Add source 2 */
gst_bin_add (GST_BIN (comp), source2); gst_bin_add (GST_BIN (comp), source2);
g_signal_emit_by_name (comp, "commit", TRUE, &ret); commit_and_wait (comp, &ret);
check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND); check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND);
/* Add operation */ /* Add operation */
gst_bin_add (GST_BIN (comp), oper); gst_bin_add (GST_BIN (comp), oper);
g_signal_emit_by_name (comp, "commit", TRUE, &ret); commit_and_wait (comp, &ret);
check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND); check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND);
/* Add default */ /* Add default */
gst_bin_add (GST_BIN (comp), def); gst_bin_add (GST_BIN (comp), def);
g_signal_emit_by_name (comp, "commit", TRUE, &ret); commit_and_wait (comp, &ret);
check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND); check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND);
@ -458,7 +458,7 @@ GST_START_TEST (test_pyramid_operations_expandable)
/* Add default */ /* Add default */
gst_bin_add (GST_BIN (comp), def); gst_bin_add (GST_BIN (comp), def);
g_signal_emit_by_name (comp, "commit", TRUE, &ret); commit_and_wait (comp, &ret);
check_start_stop_duration (source1, 0, 2 * GST_SECOND, 2 * GST_SECOND); check_start_stop_duration (source1, 0, 2 * GST_SECOND, 2 * GST_SECOND);
check_start_stop_duration (oper, 0 * GST_SECOND, 6 * GST_SECOND, check_start_stop_duration (oper, 0 * GST_SECOND, 6 * GST_SECOND,
6 * GST_SECOND); 6 * GST_SECOND);
@ -551,7 +551,7 @@ GST_START_TEST (test_complex_operations)
gst_bin_add (GST_BIN (comp), oper); gst_bin_add (GST_BIN (comp), oper);
check_start_stop_duration (comp, 0, 0, 0); check_start_stop_duration (comp, 0, 0, 0);
g_signal_emit_by_name (comp, "commit", TRUE, &ret); commit_and_wait (comp, &ret);
check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND); check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (oper, "oper", 1); ASSERT_OBJECT_REFCOUNT (oper, "oper", 1);
@ -632,14 +632,14 @@ GST_START_TEST (test_complex_operations_bis)
/* Add source1 */ /* Add source1 */
gst_bin_add (GST_BIN (comp), source1); gst_bin_add (GST_BIN (comp), source1);
g_signal_emit_by_name (comp, "commit", TRUE, &ret); commit_and_wait (comp, &ret);
check_start_stop_duration (comp, 0, 4 * GST_SECOND, 4 * GST_SECOND); check_start_stop_duration (comp, 0, 4 * GST_SECOND, 4 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source1, "source1", 1); ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
/* Add source2 */ /* Add source2 */
gst_bin_add (GST_BIN (comp), source2); gst_bin_add (GST_BIN (comp), source2);
g_signal_emit_by_name (comp, "commit", TRUE, &ret); commit_and_wait (comp, &ret);
check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND); check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source2, "source2", 1); ASSERT_OBJECT_REFCOUNT (source2, "source2", 1);
@ -647,7 +647,7 @@ GST_START_TEST (test_complex_operations_bis)
/* Add operaton */ /* Add operaton */
gst_bin_add (GST_BIN (comp), oper); gst_bin_add (GST_BIN (comp), oper);
g_signal_emit_by_name (comp, "commit", TRUE, &ret); commit_and_wait (comp, &ret);
check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND); check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND);
/* Since it's expandable, it should have changed to full length */ /* Since it's expandable, it should have changed to full length */
check_start_stop_duration (oper, 0 * GST_SECOND, 6 * GST_SECOND, check_start_stop_duration (oper, 0 * GST_SECOND, 6 * GST_SECOND,