composition: Actually commit in on our own thread

Avoiding races
This commit is contained in:
Mathieu Duponchelle 2014-06-27 16:12:12 +02:00 committed by Thibault Saunier
parent 23e7788921
commit 6dc52ca0d2
7 changed files with 131 additions and 82 deletions

View file

@ -68,6 +68,7 @@ enum
enum
{
COMMIT_SIGNAL,
COMMITED_SIGNAL,
LAST_SIGNAL
};
@ -199,6 +200,7 @@ static void
compare_relink_single_node (GnlComposition * comp, GNode * node,
GNode * oldstack);
static gboolean update_pipeline_func (GnlComposition * comp);
static gboolean commit_pipeline_func (GnlComposition *comp);
/* COMP_REAL_START: actual position to start current playback at. */
@ -387,6 +389,15 @@ _add_update_gsource (GnlComposition * comp)
MAIN_CONTEXT_UNLOCK (comp);
}
static void
_add_commit_gsource (GnlComposition * comp)
{
MAIN_CONTEXT_LOCK (comp);
g_main_context_invoke (comp->priv->mcontext,
(GSourceFunc) commit_pipeline_func, comp);
MAIN_CONTEXT_UNLOCK (comp);
}
static void
gnl_composition_class_init (GnlCompositionClass * klass)
{
@ -471,6 +482,10 @@ gnl_composition_class_init (GnlCompositionClass * klass)
G_STRUCT_OFFSET (GnlObjectClass, commit_signal_handler), NULL, NULL, NULL,
G_TYPE_BOOLEAN, 1, G_TYPE_BOOLEAN);
_signals[COMMITED_SIGNAL] = g_signal_new ("commited", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
gnlobject_class->commit = gnl_composition_commit_func;
}
@ -978,38 +993,8 @@ update_pipeline_at_current_position (GnlComposition * comp)
static gboolean
gnl_composition_commit_func (GnlObject * object, gboolean recurse)
{
GList *tmp;
gboolean commited = FALSE;
GnlComposition *comp = GNL_COMPOSITION (object);
GnlCompositionPrivate *priv = comp->priv;
GST_DEBUG_OBJECT (object, "Commiting state");
COMP_OBJECTS_LOCK (comp);
for (tmp = priv->objects_start; tmp; tmp = tmp->next) {
if (gnl_object_commit (tmp->data, recurse))
commited = TRUE;
}
GST_DEBUG_OBJECT (object, "Linking up commit vmethod");
if (commited == FALSE &&
(GNL_OBJECT_CLASS (parent_class)->commit (object, recurse) == FALSE)) {
COMP_OBJECTS_UNLOCK (comp);
GST_DEBUG_OBJECT (object, "Nothing to commit, leaving");
return FALSE;
}
/* The topology of the composition might have changed, update the lists */
priv->objects_start = g_list_sort
(priv->objects_start, (GCompareFunc) objects_start_compare);
priv->objects_stop = g_list_sort
(priv->objects_stop, (GCompareFunc) objects_stop_compare);
/* And update the pipeline at current position if needed */
update_pipeline_at_current_position (comp);
COMP_OBJECTS_UNLOCK (comp);
GST_DEBUG_OBJECT (object, "Done commiting");
GST_ERROR ("Adding commit gsource");
_add_commit_gsource (GNL_COMPOSITION (object));
return TRUE;
}
@ -1875,6 +1860,45 @@ set_child_caps (GValue * item, GValue * ret G_GNUC_UNUSED, GnlObject * comp)
return TRUE;
}
static gboolean
commit_pipeline_func (GnlComposition *comp)
{
GList *tmp;
gboolean commited = FALSE;
GnlObject *object = GNL_OBJECT (comp);
GnlCompositionPrivate *priv = comp->priv;
GST_ERROR_OBJECT (object, "Commiting state");
COMP_OBJECTS_LOCK (comp);
for (tmp = priv->objects_start; tmp; tmp = tmp->next) {
if (gnl_object_commit (tmp->data, TRUE))
commited = TRUE;
}
GST_DEBUG_OBJECT (object, "Linking up commit vmethod");
if (commited == FALSE &&
(GNL_OBJECT_CLASS (parent_class)->commit (object, TRUE) == FALSE)) {
COMP_OBJECTS_UNLOCK (comp);
GST_ERROR_OBJECT (object, "Nothing to commit, leaving");
g_signal_emit (comp, _signals[COMMITED_SIGNAL], 0, FALSE);
return G_SOURCE_REMOVE;
}
/* The topology of the composition might have changed, update the lists */
priv->objects_start = g_list_sort
(priv->objects_start, (GCompareFunc) objects_start_compare);
priv->objects_stop = g_list_sort
(priv->objects_stop, (GCompareFunc) objects_stop_compare);
/* And update the pipeline at current position if needed */
update_pipeline_at_current_position (comp);
COMP_OBJECTS_UNLOCK (comp);
GST_ERROR ("emitted signal");
g_signal_emit (comp, _signals[COMMITED_SIGNAL], 0, TRUE);
return G_SOURCE_REMOVE;
}
static gboolean
update_pipeline_func (GnlComposition * comp)
{
@ -2605,7 +2629,7 @@ update_pipeline (GnlComposition * comp, GstClockTime currenttime,
GstState nextstate = (GST_STATE_NEXT (comp) == GST_STATE_VOID_PENDING) ?
GST_STATE (comp) : GST_STATE_NEXT (comp);
GST_DEBUG_OBJECT (comp,
GST_ERROR_OBJECT (comp,
"currenttime:%" GST_TIME_FORMAT
" initial:%d , modify:%d", GST_TIME_ARGS (currenttime), initial, modify);
@ -2779,7 +2803,6 @@ chiringuito:
}
}
static gboolean
gnl_composition_remove_object (GstBin * bin, GstElement * element)
{

View file

@ -346,3 +346,24 @@ copy_segment_list (GList * list)
return res;
}
static GMutex lock;
static GCond cond;
static void
commited_cb (GstElement * comp, gboolean changed)
{
GST_ERROR ("commited !!");
g_mutex_lock (&lock);
g_cond_signal (&cond);
g_mutex_unlock (&lock);
}
void
commit_and_wait (GstElement * comp, gboolean * ret)
{
g_signal_connect (comp, "commited", (GCallback) commited_cb, NULL);
g_mutex_lock (&lock);
g_signal_emit_by_name (comp, "commit", TRUE, ret);
g_cond_wait (&cond, &lock);
g_mutex_unlock (&lock);
}

View file

@ -71,3 +71,5 @@ GstElement *
gst_element_factory_make_or_warn (const gchar * factoryname, const gchar * name);
Segment *
segment_new (gdouble rate, GstFormat format, gint64 start, gint64 stop, gint64 position);
void commit_and_wait (GstElement *comp, gboolean *ret);

View file

@ -185,7 +185,7 @@ GST_START_TEST (test_one_space_another)
/* Add one source */
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, 1 * GST_SECOND, 1 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
@ -194,7 +194,7 @@ GST_START_TEST (test_one_space_another)
gst_bin_add (GST_BIN (comp), source2);
check_start_stop_duration (comp, 0, 1 * GST_SECOND, 1 * GST_SECOND);
g_signal_emit_by_name (comp, "commit", TRUE, &ret);
check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND);
commit_and_wait (comp, &ret);
ASSERT_OBJECT_REFCOUNT (source2, "source2", 1);
/* Remove first source */
@ -208,7 +208,7 @@ GST_START_TEST (test_one_space_another)
/* Re-add first source */
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, 3 * GST_SECOND, 3 * GST_SECOND);
gst_object_unref (source1);
ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
@ -291,14 +291,14 @@ GST_START_TEST (test_one_default_another)
/* Add one source */
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, GST_SECOND, 2 * GST_SECOND, 1 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
/* defaultsrc source */
gst_bin_add (GST_BIN (comp), defaultsrc);
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 (defaultsrc, 0, 2 * GST_SECOND, 2 * GST_SECOND);
@ -310,7 +310,7 @@ GST_START_TEST (test_one_default_another)
ASSERT_OBJECT_REFCOUNT (source2, "source2", 1);
/* Third source */
gst_bin_add (GST_BIN (comp), source3);
g_signal_emit_by_name (comp, "commit", TRUE, &ret);
commit_and_wait (comp, &ret);
fail_unless (ret);
check_start_stop_duration (comp, 0, 5 * GST_SECOND, 5 * GST_SECOND);
check_start_stop_duration (defaultsrc, 0, 5 * GST_SECOND, 5 * GST_SECOND);
@ -405,7 +405,7 @@ GST_START_TEST (test_one_expandable_another)
/* Add one source */
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, GST_SECOND, 2 * GST_SECOND, 1 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
@ -413,7 +413,7 @@ GST_START_TEST (test_one_expandable_another)
/* defaultsrc source */
gst_bin_add (GST_BIN (comp), defaultsrc);
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 (defaultsrc, 0, 2 * GST_SECOND, 2 * GST_SECOND);
@ -422,7 +422,7 @@ GST_START_TEST (test_one_expandable_another)
/* Second source */
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, 4 * GST_SECOND, 4 * GST_SECOND);
check_start_stop_duration (defaultsrc, 0, 4 * GST_SECOND, 4 * GST_SECOND);
@ -432,7 +432,7 @@ GST_START_TEST (test_one_expandable_another)
/* Third source */
gst_bin_add (GST_BIN (comp), source3);
g_signal_emit_by_name (comp, "commit", TRUE, &ret);
commit_and_wait (comp, &ret);
check_start_stop_duration (comp, 0, 5 * GST_SECOND, 5 * GST_SECOND);
check_start_stop_duration (defaultsrc, 0, 5 * GST_SECOND, 5 * GST_SECOND);
@ -515,7 +515,7 @@ GST_START_TEST (test_renegotiation)
/* Add one source */
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, 1 * GST_SECOND, 1 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
@ -523,7 +523,7 @@ GST_START_TEST (test_renegotiation)
/* Second source */
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, 2 * GST_SECOND, 2 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source2, "source2", 1);
@ -532,7 +532,7 @@ GST_START_TEST (test_renegotiation)
/* Third source */
gst_bin_add (GST_BIN (comp), source3);
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);
ASSERT_OBJECT_REFCOUNT (source3, "source3", 1);
@ -710,13 +710,13 @@ GST_START_TEST (test_one_bin_space_another)
/* Add one source */
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, 1 * GST_SECOND, 1 * GST_SECOND);
/* Second source */
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, 3 * GST_SECOND, 3 * GST_SECOND);
/* Remove second source */
@ -729,7 +729,7 @@ GST_START_TEST (test_one_bin_space_another)
/* Re-add second source */
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, 3 * GST_SECOND, 3 * GST_SECOND);
gst_object_unref (source1);
@ -776,13 +776,13 @@ GST_START_TEST (test_one_above_another)
/* Add one source */
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);
/* Second source */
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, 3 * GST_SECOND, 3 * GST_SECOND);
/* Remove second source */
@ -795,7 +795,7 @@ GST_START_TEST (test_one_above_another)
/* Re-add second source */
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, 3 * GST_SECOND, 3 * GST_SECOND);
gst_object_unref (source1);

View file

@ -87,7 +87,7 @@ GST_START_TEST (test_change_object_start_stop_in_current_stack)
/* Add default */
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 (comp, 0, 2 * GST_SECOND, 2 * GST_SECOND);
@ -133,7 +133,7 @@ GST_START_TEST (test_change_object_start_stop_in_current_stack)
/* move source1 out of the active segment */
g_object_set (source1, "start", (guint64) 4 * GST_SECOND, NULL);
g_signal_emit_by_name (comp, "commit", TRUE, &ret);
commit_and_wait (comp, &ret);
fail_unless (seek_events > seek_events_before, "%i > %i", seek_events,
seek_events_before);
@ -144,7 +144,7 @@ GST_START_TEST (test_change_object_start_stop_in_current_stack)
g_object_set (source1, "start", (guint64) 0 * GST_SECOND, NULL);
/* add the source again and check that the ghostpad is added again */
gst_bin_add (GST_BIN (comp), source1);
g_signal_emit_by_name (comp, "commit", TRUE, &ret);
commit_and_wait (comp, &ret);
g_mutex_lock (&pad_added_lock);
g_cond_wait (&pad_added_cond, &pad_added_lock);
@ -155,7 +155,7 @@ GST_START_TEST (test_change_object_start_stop_in_current_stack)
seek_events_before = seek_events;
g_object_set (source1, "duration", (guint64) 1 * GST_SECOND, NULL);
g_signal_emit_by_name (comp, "commit", TRUE, &ret);
commit_and_wait (comp, &ret);
fail_unless (seek_events > seek_events_before);
GST_DEBUG ("Setting pipeline to NULL");
@ -213,6 +213,7 @@ GST_START_TEST (test_simple_adder)
pipeline = GST_ELEMENT (gst_pipeline_new (NULL));
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
GST_ERROR ("Pipeline refcounts: %i", ((GObject *) pipeline)->ref_count);
composition = gst_element_factory_make ("gnlcomposition", "composition");
fakesink = gst_element_factory_make ("fakesink", NULL);
@ -226,6 +227,7 @@ GST_START_TEST (test_simple_adder)
"priority", 0, NULL);
gst_bin_add (GST_BIN (composition), gnl_adder);
GST_ERROR ("Pipeline refcounts: %i", ((GObject *) pipeline)->ref_count);
/* source 1 */
gnlsource1 = gst_element_factory_make ("gnlsource", "gnlsource1");
audiotestsrc1 = gst_element_factory_make ("audiotestsrc", "audiotestsrc1");
@ -245,6 +247,8 @@ GST_START_TEST (test_simple_adder)
GST_DEBUG ("Adding composition to pipeline");
gst_bin_add_many (GST_BIN (pipeline), composition, fakesink, NULL);
GST_ERROR ("Pipeline refcounts: %i", ((GObject *) pipeline)->ref_count);
fail_unless (gst_bin_add (GST_BIN (composition), gnlsource2));
fail_unless (gst_element_link (composition, fakesink) == TRUE);
@ -256,7 +260,6 @@ GST_START_TEST (test_simple_adder)
message = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE,
GST_MESSAGE_ASYNC_DONE | GST_MESSAGE_ERROR);
gst_mini_object_unref (GST_MINI_OBJECT (message));
if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR)
@ -307,8 +310,8 @@ GST_START_TEST (test_simple_adder)
}
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
gst_object_unref (pipeline);
gst_object_unref (bus);
gst_object_unref (pipeline);
}
GST_END_TEST;

View file

@ -185,7 +185,7 @@ test_simplest_full (void)
/* Add one source */
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, 1 * GST_SECOND, 1 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
@ -270,7 +270,7 @@ test_one_after_other_full (void)
/* Add sources */
gst_bin_add (GST_BIN (comp), source1);
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 (source1, 0, 1 * GST_SECOND, 1 * GST_SECOND);
check_start_stop_duration (source2, 1 * GST_SECOND, 2 * GST_SECOND,
1 * GST_SECOND);
@ -352,7 +352,7 @@ test_one_under_another_full (void)
gst_bin_add (GST_BIN (comp), source1);
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 (source1, 0, 2 * GST_SECOND, 2 * GST_SECOND);
check_start_stop_duration (source2, 1 * GST_SECOND, 3 * GST_SECOND,
2 * GST_SECOND);
@ -429,7 +429,7 @@ test_one_bin_after_other_full (void)
/* Second source */
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 (source1, 0, 1 * GST_SECOND, 1 * GST_SECOND);
check_start_stop_duration (source2, 1 * GST_SECOND, 2 * GST_SECOND,
1 * GST_SECOND);
@ -533,14 +533,14 @@ GST_START_TEST (test_complex_operations)
/* Add 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);
ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
/* Add 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);
ASSERT_OBJECT_REFCOUNT (source2, "source2", 1);
@ -548,7 +548,7 @@ GST_START_TEST (test_complex_operations)
/* Add operaton */
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);
ASSERT_OBJECT_REFCOUNT (oper, "oper", 1);
@ -653,14 +653,14 @@ GST_START_TEST (test_complex_operations_bis)
/* Add 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);
ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
/* Add 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);
ASSERT_OBJECT_REFCOUNT (source2, "source2", 1);
@ -668,7 +668,7 @@ GST_START_TEST (test_complex_operations_bis)
/* Add operaton */
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 (source1, 0, 4 * GST_SECOND, 4 * GST_SECOND);
check_start_stop_duration (source2, 2 * GST_SECOND, 6 * GST_SECOND,
4 * GST_SECOND);

View file

@ -32,7 +32,7 @@ test_simplest_full (void)
/* Add one source */
gst_bin_add (GST_BIN (comp), source1);
g_signal_emit_by_name (comp, "commit", TRUE, &ret);
commit_and_wait (comp, &ret);
fail_unless (ret);
check_start_stop_duration (source1, 0, 1 * GST_SECOND, 1 * GST_SECOND);
check_start_stop_duration (comp, 0, 1 * GST_SECOND, 1 * GST_SECOND);
@ -143,7 +143,7 @@ test_time_duration_full (void)
ASSERT_OBJECT_REFCOUNT (source2, "source2", 1);
gst_bin_add (GST_BIN (comp), source1);
g_signal_emit_by_name (comp, "commit", TRUE, &ret);
commit_and_wait (comp, &ret);
fail_unless (ret == TRUE);
check_start_stop_duration (comp, 0, 1 * GST_SECOND, 1 * GST_SECOND);
@ -153,7 +153,7 @@ test_time_duration_full (void)
ret = FALSE;
gst_bin_add (GST_BIN (comp), source2);
g_signal_emit_by_name (comp, "commit", TRUE, &ret);
commit_and_wait (comp, &ret);
fail_unless (ret == TRUE);
check_start_stop_duration (comp, 0, 2 * GST_SECOND, 2 * GST_SECOND);
@ -163,7 +163,7 @@ test_time_duration_full (void)
gst_object_ref (source1);
gst_bin_remove (GST_BIN (comp), source1);
g_signal_emit_by_name (comp, "commit", TRUE, &ret);
commit_and_wait (comp, &ret);
check_start_stop_duration (comp, 1 * GST_SECOND, 2 * GST_SECOND,
1 * GST_SECOND);
@ -172,7 +172,7 @@ test_time_duration_full (void)
/* Re-add first source */
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);
gst_object_unref (source1);
@ -227,7 +227,7 @@ test_one_after_other_full (void)
/* Add one source */
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, 1 * GST_SECOND, 1 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
@ -235,7 +235,7 @@ test_one_after_other_full (void)
/* Second source */
gst_bin_add (GST_BIN (comp), source2);
g_signal_emit_by_name (comp, "commit", TRUE, &ret);
commit_and_wait (comp, &ret);
fail_unless (ret);
check_start_stop_duration (source1, 0 * GST_SECOND, 1 * GST_SECOND,
1 * GST_SECOND);
@ -257,7 +257,7 @@ test_one_after_other_full (void)
/* Re-add first source */
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);
gst_object_unref (source1);
@ -440,7 +440,7 @@ test_one_under_another_full (void)
gst_bin_add (GST_BIN (comp), source2);
check_start_stop_duration (comp, 0, 0 * GST_SECOND, 0 * GST_SECOND);
/* Now commiting changes */
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 (source1, 0, 2 * GST_SECOND, 2 * GST_SECOND);
check_start_stop_duration (source2, 1 * GST_SECOND, 3 * GST_SECOND,
@ -456,7 +456,7 @@ test_one_under_another_full (void)
/* Re-add second source */
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, 3 * GST_SECOND, 3 * GST_SECOND);
gst_object_unref (source1);
@ -577,7 +577,7 @@ test_one_bin_after_other_full (void)
/* Add one source */
gst_bin_add (GST_BIN (comp), source1);
g_signal_emit_by_name (comp, "commit", TRUE, &ret);
commit_and_wait (comp, &ret);
fail_unless (ret);
check_start_stop_duration (comp, 0, 1 * GST_SECOND, 1 * GST_SECOND);
check_start_stop_duration (source1, 0, 1 * GST_SECOND, 1 * GST_SECOND);
@ -587,7 +587,7 @@ test_one_bin_after_other_full (void)
/* Second source */
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, 2 * GST_SECOND, 2 * GST_SECOND);
check_start_stop_duration (source1, 0, 1 * GST_SECOND, 1 * GST_SECOND);
check_start_stop_duration (source2, 1 * GST_SECOND, 2 * GST_SECOND,
@ -607,7 +607,7 @@ test_one_bin_after_other_full (void)
/* Re-add first source */
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);
gst_object_unref (source1);