summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnl/gnlcomposition.c185
-rw-r--r--tests/check/Makefile.am2
-rw-r--r--tests/check/common.h29
-rw-r--r--tests/check/simple.c141
4 files changed, 308 insertions, 49 deletions
diff --git a/gnl/gnlcomposition.c b/gnl/gnlcomposition.c
index 878ebf4..5a592b3 100644
--- a/gnl/gnlcomposition.c
+++ b/gnl/gnlcomposition.c
@@ -49,6 +49,12 @@ GST_STATIC_PAD_TEMPLATE ("src",
GST_DEBUG_CATEGORY_STATIC (gnlcomposition);
#define GST_CAT_DEFAULT gnlcomposition
+enum
+{
+ ARG_0,
+ ARG_UPDATE,
+};
+
struct _GnlCompositionPrivate
{
gboolean dispose_has_run;
@@ -65,6 +71,14 @@ struct _GnlCompositionPrivate
GHashTable *objects_hash;
GMutex *objects_lock;
+ /* Update properties
+ * can_update: If True, updates should be taken into account immediatly, else
+ * they should be postponed until it is set to True again.
+ * update_required: Set to True if an update is required when the
+ * can_update property just above is set back to True. */
+ gboolean can_update;
+ gboolean update_required;
+
/*
thread-safe Seek handling.
flushing_lock : mutex to access flushing and pending_idle
@@ -123,6 +137,10 @@ struct _GnlCompositionPrivate
static void gnl_composition_dispose (GObject * object);
static void gnl_composition_finalize (GObject * object);
+static void gnl_composition_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspsec);
+static void gnl_composition_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspsec);
static void gnl_composition_reset (GnlComposition * comp);
static gboolean gnl_composition_add_object (GstBin * bin, GstElement * element);
@@ -140,7 +158,11 @@ static void pad_blocked (GstPad * pad, gboolean blocked, GnlComposition * comp);
static gboolean
seek_handling (GnlComposition * comp, gboolean initial, gboolean update);
+static gint objects_start_compare (GnlObject * a, GnlObject * b);
+static gint objects_stop_compare (GnlObject * a, GnlObject * b);
+static GstClockTime get_current_position (GnlComposition * comp);
+static void gnl_composition_set_update (GnlComposition * comp, gboolean update);
static gboolean
update_pipeline (GnlComposition * comp, GstClockTime currenttime,
gboolean initial, gboolean change_state, gboolean modify);
@@ -229,6 +251,10 @@ gnl_composition_class_init (GnlCompositionClass * klass)
gobject_class->dispose = GST_DEBUG_FUNCPTR (gnl_composition_dispose);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gnl_composition_finalize);
+ gobject_class->set_property =
+ GST_DEBUG_FUNCPTR (gnl_composition_set_property);
+ gobject_class->get_property =
+ GST_DEBUG_FUNCPTR (gnl_composition_get_property);
gstelement_class->change_state = gnl_composition_change_state;
@@ -240,6 +266,10 @@ gnl_composition_class_init (GnlCompositionClass * klass)
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gnl_composition_src_template));
+
+ g_object_class_install_property (gobject_class, ARG_UPDATE,
+ g_param_spec_boolean ("update", "Update", "Update immediatly any changes",
+ TRUE, G_PARAM_READWRITE));
}
static void
@@ -271,6 +301,9 @@ gnl_composition_init (GnlComposition * comp,
comp->private->objects_start = NULL;
comp->private->objects_stop = NULL;
+ comp->private->can_update = TRUE;
+ comp->private->update_required = FALSE;
+
comp->private->flushing_lock = g_mutex_new ();
comp->private->flushing = FALSE;
comp->private->pending_idle = 0;
@@ -285,7 +318,6 @@ gnl_composition_init (GnlComposition * comp,
(g_direct_hash,
g_direct_equal, NULL, (GDestroyNotify) hash_value_destroy);
-
gnl_composition_reset (comp);
}
@@ -299,6 +331,9 @@ gnl_composition_dispose (GObject * object)
comp->private->dispose_has_run = TRUE;
+ comp->private->can_update = TRUE;
+ comp->private->update_required = FALSE;
+
if (comp->private->ghostpad) {
gnl_object_remove_ghost_pad ((GnlObject *) object, comp->private->ghostpad);
comp->private->ghostpad = NULL;
@@ -344,6 +379,38 @@ gnl_composition_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+static void
+gnl_composition_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
+{
+ GnlComposition *comp = (GnlComposition *) object;
+
+ switch (prop_id) {
+ case ARG_UPDATE:
+ gnl_composition_set_update (comp, g_value_get_boolean (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gnl_composition_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
+{
+ GnlComposition *comp = (GnlComposition *) object;
+
+ switch (prop_id) {
+ case ARG_UPDATE:
+ g_value_set_boolean (value, comp->private->can_update);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
/* signal_duration_change
* Creates a new GST_MESSAGE_DURATION with the currently configured
* composition duration and sends that on the bus.
@@ -466,6 +533,8 @@ gnl_composition_reset (GnlComposition * comp)
comp->private->flushing = FALSE;
COMP_FLUSHING_UNLOCK (comp);
+ comp->private->update_required = FALSE;
+
GST_DEBUG_OBJECT (comp, "Composition now resetted");
}
@@ -633,6 +702,44 @@ have_to_update_pipeline (GnlComposition * comp)
return FALSE;
}
+static void
+gnl_composition_set_update (GnlComposition * comp, gboolean update)
+{
+ if (G_UNLIKELY (update == comp->private->can_update))
+ return;
+
+ GST_DEBUG_OBJECT (comp, "update:%d [currently %d], update_required:%d",
+ update, comp->private->can_update, comp->private->update_required);
+
+ COMP_OBJECTS_LOCK (comp);
+ comp->private->can_update = update;
+
+ if (update && comp->private->update_required) {
+ GstClockTime curpos;
+
+ /* Make sure the lists are updated */
+ comp->private->objects_start = g_list_sort
+ (comp->private->objects_start, (GCompareFunc) objects_start_compare);
+
+ comp->private->objects_stop = g_list_sort
+ (comp->private->objects_stop, (GCompareFunc) objects_stop_compare);
+
+ /* Get current position */
+ if ((curpos = get_current_position (comp)) == GST_CLOCK_TIME_NONE) {
+ if (GST_CLOCK_TIME_IS_VALID (comp->private->segment_start))
+ curpos = comp->private->segment->start = comp->private->segment_start;
+ else
+ curpos = 0;
+ }
+
+ COMP_OBJECTS_UNLOCK (comp);
+
+ /* update pipeline to that position */
+ update_pipeline (comp, curpos, TRUE, TRUE, TRUE);
+ } else
+ COMP_OBJECTS_UNLOCK (comp);
+}
+
/*
* get_new_seek_event:
*
@@ -1307,6 +1414,7 @@ gnl_composition_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_READY_TO_PAUSED:{
GstIterator *childs;
+ gnl_composition_reset (comp);
/* state-lock all elements */
GST_DEBUG_OBJECT (comp,
"Setting all childs to READY and locking their state");
@@ -1413,6 +1521,8 @@ update_start_stop_duration (GnlComposition * comp)
/* If we have a default object, the start position is 0 */
if (comp->private->defaultobject) {
+ GST_LOG_OBJECT (cobj,
+ "Setting start to 0 because we have a default object");
if (cobj->start != 0) {
cobj->start = 0;
g_object_notify (G_OBJECT (cobj), "start");
@@ -1927,6 +2037,8 @@ update_pipeline (GnlComposition * comp, GstClockTime currenttime,
{
gboolean ret = TRUE;
+ g_return_val_if_fail (comp->private->can_update, FALSE);
+
GST_DEBUG_OBJECT (comp,
"currenttime:%" GST_TIME_FORMAT
" initial:%d , change_state:%d , modify:%d", GST_TIME_ARGS (currenttime),
@@ -1936,7 +2048,7 @@ update_pipeline (GnlComposition * comp, GstClockTime currenttime,
update_start_stop_duration (comp);
- if ((GST_CLOCK_TIME_IS_VALID (currenttime))) {
+ if (GST_CLOCK_TIME_IS_VALID (currenttime)) {
GstState state = GST_STATE (comp);
GstState nextstate =
(GST_STATE_NEXT (comp) ==
@@ -2105,15 +2217,23 @@ object_start_stop_priority_changed (GnlObject * object,
GST_TIME_ARGS (object->start),
GST_TIME_ARGS (object->stop), object->priority);
+ if (!comp->private->can_update) {
+ comp->private->update_required = TRUE;
+ return;
+ }
+
+ /* The topology of the ocmposition might have changed, update the lists */
comp->private->objects_start = g_list_sort
(comp->private->objects_start, (GCompareFunc) objects_start_compare);
comp->private->objects_stop = g_list_sort
(comp->private->objects_stop, (GCompareFunc) objects_stop_compare);
- if (comp->private->current && (OBJECT_IN_ACTIVE_SEGMENT (comp, object) ||
- g_node_find (comp->private->current,
- G_IN_ORDER, G_TRAVERSE_ALL, object))) {
+ /* Update pipeline if needed */
+ if (comp->private->current &&
+ (OBJECT_IN_ACTIVE_SEGMENT (comp, object) ||
+ g_node_find (comp->private->current, G_IN_ORDER, G_TRAVERSE_ALL,
+ object))) {
GstClockTime curpos = get_current_position (comp);
if (curpos == GST_CLOCK_TIME_NONE)
curpos = comp->private->segment->start = comp->private->segment_start;
@@ -2129,6 +2249,11 @@ object_active_changed (GnlObject * object, GParamSpec * arg G_GNUC_UNUSED,
GST_DEBUG_OBJECT (object,
"active flag changed (%d), evaluating pipeline update", object->active);
+ if (!comp->private->can_update) {
+ comp->private->update_required = TRUE;
+ return;
+ }
+
if (comp->private->current && OBJECT_IN_ACTIVE_SEGMENT (comp, object)) {
GstClockTime curpos = get_current_position (comp);
if (curpos == GST_CLOCK_TIME_NONE)
@@ -2177,7 +2302,8 @@ gnl_composition_add_object (GstBin * bin, GstElement * element)
gboolean ret;
GnlCompositionEntry *entry;
GnlComposition *comp = (GnlComposition *) bin;
- GstClockTime curpos;
+ gboolean update_required;
+ GstClockTime curpos = GST_CLOCK_TIME_NONE;
GST_DEBUG_OBJECT (bin, "element %s", GST_OBJECT_NAME (element));
@@ -2283,17 +2409,25 @@ gnl_composition_add_object (GstBin * bin, GstElement * element)
GST_TIME_ARGS (comp->private->segment_start),
GST_TIME_ARGS (comp->private->segment_stop));
- if ((curpos = get_current_position (comp)) == GST_CLOCK_TIME_NONE)
- curpos = comp->private->segment_start;
+ update_required = OBJECT_IN_ACTIVE_SEGMENT (comp, element)
+ || (!comp->private->current);
+
+ /* We only need the current position if we're going to update */
+ if (update_required && comp->private->can_update)
+ if ((curpos = get_current_position (comp)) == GST_CLOCK_TIME_NONE)
+ curpos = comp->private->segment_start;
COMP_OBJECTS_UNLOCK (comp);
/* If we added within currently configured segment OR the pipeline was *
* previously empty, THEN update pipeline */
- if (OBJECT_IN_ACTIVE_SEGMENT (comp, element) || (!comp->private->current))
- update_pipeline (comp, curpos, TRUE, TRUE, TRUE);
- else
- update_start_stop_duration (comp);
+ if (comp->private->can_update) {
+ if (update_required)
+ update_pipeline (comp, curpos, TRUE, TRUE, TRUE);
+ else
+ update_start_stop_duration (comp);
+ } else
+ comp->private->update_required |= update_required;
beach:
gst_object_unref (element);
@@ -2309,9 +2443,10 @@ chiringuito:
static gboolean
gnl_composition_remove_object (GstBin * bin, GstElement * element)
{
- gboolean ret = GST_STATE_CHANGE_FAILURE;
GnlComposition *comp = (GnlComposition *) bin;
- GstClockTime curpos;
+ GstClockTime curpos = GST_CLOCK_TIME_NONE;
+ gboolean ret = GST_STATE_CHANGE_FAILURE;
+ gboolean update_required;
GST_DEBUG_OBJECT (bin, "element %s", GST_OBJECT_NAME (element));
/* we only accept GnlObject */
@@ -2344,18 +2479,26 @@ gnl_composition_remove_object (GstBin * bin, GstElement * element)
if (!(g_hash_table_remove (comp->private->objects_hash, element)))
goto chiringuito;
- if ((curpos = get_current_position (comp)) == GST_CLOCK_TIME_NONE)
- curpos = comp->private->segment_start;
+ update_required = OBJECT_IN_ACTIVE_SEGMENT (comp, element) ||
+ ((GnlObject *) element)->priority == G_MAXUINT32;
+
+ if (update_required && comp->private->can_update) {
+ curpos = get_current_position (comp);
+ if (G_UNLIKELY (curpos == GST_CLOCK_TIME_NONE))
+ curpos = comp->private->segment_start;
+ }
COMP_OBJECTS_UNLOCK (comp);
/* If we removed within currently configured segment, or it was the default source, *
* update pipeline */
- if (OBJECT_IN_ACTIVE_SEGMENT (comp, element)
- || (((GnlObject *) element)->priority == G_MAXUINT32))
- update_pipeline (comp, curpos, TRUE, TRUE, TRUE);
- else
- update_start_stop_duration (comp);
+ if (comp->private->can_update) {
+ if (update_required) {
+ update_pipeline (comp, curpos, TRUE, TRUE, TRUE);
+ } else
+ update_start_stop_duration (comp);
+ } else
+ comp->private->update_required |= update_required;
ret = GST_BIN_CLASS (parent_class)->remove_element (bin, element);
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am
index af258ba..1c7b7e9 100644
--- a/tests/check/Makefile.am
+++ b/tests/check/Makefile.am
@@ -33,7 +33,7 @@ noinst_HEADERS = \
# these tests don't even pass
noinst_PROGRAMS =
-AM_CFLAGS = $(GST_OBJ_CFLAGS) $(GST_CHECK_CFLAGS) $(CHECK_CFLAGS)
+AM_CFLAGS = -I./ $(GST_OBJ_CFLAGS) $(GST_CHECK_CFLAGS) $(CHECK_CFLAGS)
LDADD = $(GST_OBJ_LIBS) $(GST_CHECK_LIBS) $(CHECK_LIBS)
SUPPRESSIONS = $(top_srcdir)/common/gst.supp
diff --git a/tests/check/common.h b/tests/check/common.h
index 8b8b322..fca82a7 100644
--- a/tests/check/common.h
+++ b/tests/check/common.h
@@ -1,6 +1,27 @@
#include <gst/check/gstcheck.h>
+#define fail_unless_equals_int64(a, b) \
+G_STMT_START { \
+ gint64 first = a; \
+ gint64 second = b; \
+ fail_unless(first == second, \
+ "'" #a "' (%" G_GINT64_FORMAT ") is not equal to '" #b"' (%" \
+ G_GINT64_FORMAT ")", first, second); \
+} G_STMT_END;
+
+#define check_start_stop_duration(object, startval, stopval, durval) \
+ G_STMT_START { guint64 start, stop; \
+ gint64 duration; \
+ GST_DEBUG_OBJECT (object, "Checking for valid start/stop/duration values"); \
+ g_object_get (object, "start", &start, "stop", &stop, \
+ "duration", &duration, NULL); \
+ fail_unless_equals_uint64(start, startval); \
+ fail_unless_equals_uint64(stop, stopval); \
+ fail_unless_equals_int64(duration, durval); \
+ GST_DEBUG_OBJECT (object, "start/stop/duration values valid"); \
+ } G_STMT_END;
+
typedef struct _Segment {
gdouble rate;
GstFormat format;
@@ -267,11 +288,3 @@ segment_new (gdouble rate, GstFormat format, gint64 start, gint64 stop, gint64 p
return segment;
}
-#define check_start_stop_duration(object, startval, stopval, durval) \
- { \
- g_object_get (object, "start", &start, "stop", &stop, "duration", &duration, NULL); \
- fail_if (start != startval); \
- fail_if (stop != stopval); \
- fail_if (duration != durval); \
- }
-
diff --git a/tests/check/simple.c b/tests/check/simple.c
index fbfff13..9e02c79 100644
--- a/tests/check/simple.c
+++ b/tests/check/simple.c
@@ -1,7 +1,12 @@
#include "common.h"
-GST_START_TEST (test_time_duration)
+/* macros for 'update' property enabling */
+#define DISABLE_ASYNC_UPDATE { if (async) g_object_set(comp, "update", FALSE, NULL); }
+#define ENABLE_ASYNC_UPDATE { if (async) g_object_set(comp, "update", TRUE, NULL); }
+
+static void
+test_time_duration_full (gboolean async)
{
guint64 start, stop;
gint64 duration;
@@ -35,14 +40,22 @@ GST_START_TEST (test_time_duration)
ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
ASSERT_OBJECT_REFCOUNT (source2, "source2", 1);
+ DISABLE_ASYNC_UPDATE;
gst_bin_add (GST_BIN (comp), source1);
+ if (async)
+ check_start_stop_duration (comp, 0, 0, 0);
+ ENABLE_ASYNC_UPDATE;
check_start_stop_duration (comp, 0, 1 * GST_SECOND, 1 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
/* Second source */
+ DISABLE_ASYNC_UPDATE;
gst_bin_add (GST_BIN (comp), source2);
+ if (async)
+ check_start_stop_duration (comp, 0, 1 * GST_SECOND, 1 * GST_SECOND);
+ ENABLE_ASYNC_UPDATE;
check_start_stop_duration (comp, 0, 2 * GST_SECOND, 2 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source2, "source2", 1);
@@ -50,7 +63,11 @@ GST_START_TEST (test_time_duration)
/* Remove first source */
gst_object_ref (source1);
+ DISABLE_ASYNC_UPDATE;
gst_bin_remove (GST_BIN (comp), source1);
+ if (async)
+ check_start_stop_duration (comp, 0, 2 * GST_SECOND, 2 * GST_SECOND);
+ ENABLE_ASYNC_UPDATE;
check_start_stop_duration (comp, 1 * GST_SECOND, 2 * GST_SECOND,
1 * GST_SECOND);
@@ -58,7 +75,12 @@ GST_START_TEST (test_time_duration)
/* Re-add first source */
+ DISABLE_ASYNC_UPDATE;
gst_bin_add (GST_BIN (comp), source1);
+ if (async)
+ check_start_stop_duration (comp, 1 * GST_SECOND, 2 * GST_SECOND,
+ 1 * GST_SECOND);
+ ENABLE_ASYNC_UPDATE;
check_start_stop_duration (comp, 0, 2 * GST_SECOND, 2 * GST_SECOND);
gst_object_unref (source1);
@@ -67,9 +89,8 @@ GST_START_TEST (test_time_duration)
gst_object_unref (comp);
}
-GST_END_TEST;
-
-GST_START_TEST (test_one_after_other)
+static void
+test_one_after_other_full (gboolean async)
{
GstElement *pipeline;
GstElement *comp, *sink, *source1, *source2;
@@ -116,14 +137,18 @@ GST_START_TEST (test_one_after_other)
/* Add one source */
+ DISABLE_ASYNC_UPDATE;
gst_bin_add (GST_BIN (comp), source1);
+ ENABLE_ASYNC_UPDATE;
check_start_stop_duration (comp, 0, 1 * GST_SECOND, 1 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
/* Second source */
+ DISABLE_ASYNC_UPDATE;
gst_bin_add (GST_BIN (comp), source2);
+ ENABLE_ASYNC_UPDATE;
check_start_stop_duration (comp, 0, 2 * GST_SECOND, 2 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source2, "source2", 1);
@@ -131,7 +156,9 @@ GST_START_TEST (test_one_after_other)
/* Remove first source */
gst_object_ref (source1);
+ DISABLE_ASYNC_UPDATE;
gst_bin_remove (GST_BIN (comp), source1);
+ ENABLE_ASYNC_UPDATE;
check_start_stop_duration (comp, 1 * GST_SECOND, 2 * GST_SECOND,
1 * GST_SECOND);
@@ -139,7 +166,9 @@ GST_START_TEST (test_one_after_other)
/* Re-add first source */
+ DISABLE_ASYNC_UPDATE;
gst_bin_add (GST_BIN (comp), source1);
+ ENABLE_ASYNC_UPDATE;
check_start_stop_duration (comp, 0, 2 * GST_SECOND, 2 * GST_SECOND);
gst_object_unref (source1);
@@ -230,7 +259,7 @@ GST_START_TEST (test_one_after_other)
carry_on = TRUE;
- GST_DEBUG ("Let's poll the bus");
+ GST_DEBUG ("Let's poll the bus AGAIN");
while (carry_on) {
message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 2);
@@ -273,9 +302,8 @@ GST_START_TEST (test_one_after_other)
g_free (collect);
}
-GST_END_TEST;
-
-GST_START_TEST (test_one_under_another)
+static void
+test_one_under_another_full (gboolean async)
{
GstElement *pipeline;
GstElement *comp, *sink, *source1, *source2;
@@ -295,7 +323,7 @@ GST_START_TEST (test_one_under_another)
/*
Source 1
Start : 0s
- Duration : 4s
+ Duration : 2s
Priority : 1
*/
source1 = videotest_gnl_src ("source1", 0, 2 * GST_SECOND, 1, 1);
@@ -304,8 +332,8 @@ GST_START_TEST (test_one_under_another)
/*
Source 2
- Start : 2s
- Duration : 4s
+ Start : 1s
+ Duration : 2s
Priority : 2
*/
source2 = videotest_gnl_src ("source2", 1 * GST_SECOND, 2 * GST_SECOND, 2, 2);
@@ -313,26 +341,28 @@ GST_START_TEST (test_one_under_another)
check_start_stop_duration (source2, 1 * GST_SECOND, 3 * GST_SECOND,
2 * GST_SECOND);
- /* Add one source */
+ /* Add two sources */
+ DISABLE_ASYNC_UPDATE;
gst_bin_add (GST_BIN (comp), source1);
- check_start_stop_duration (comp, 0, 2 * GST_SECOND, 2 * GST_SECOND);
-
- /* Second source */
-
gst_bin_add (GST_BIN (comp), source2);
+ ENABLE_ASYNC_UPDATE;
check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND);
/* Remove second source */
gst_object_ref (source1);
+ DISABLE_ASYNC_UPDATE;
gst_bin_remove (GST_BIN (comp), source1);
+ ENABLE_ASYNC_UPDATE;
check_start_stop_duration (comp, 1 * GST_SECOND, 3 * GST_SECOND,
2 * GST_SECOND);
/* Re-add second source */
+ DISABLE_ASYNC_UPDATE;
gst_bin_add (GST_BIN (comp), source1);
+ ENABLE_ASYNC_UPDATE;
check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND);
gst_object_unref (source1);
@@ -404,9 +434,8 @@ GST_START_TEST (test_one_under_another)
g_free (collect);
}
-GST_END_TEST;
-
-GST_START_TEST (test_one_bin_after_other)
+static void
+test_one_bin_after_other_full (gboolean async)
{
GstElement *pipeline;
GstElement *comp, *sink, *source1, *source2;
@@ -452,14 +481,20 @@ GST_START_TEST (test_one_bin_after_other)
/* Add one source */
+ DISABLE_ASYNC_UPDATE;
gst_bin_add (GST_BIN (comp), source1);
+ ENABLE_ASYNC_UPDATE;
check_start_stop_duration (comp, 0, 1 * GST_SECOND, 1 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
/* Second source */
+ DISABLE_ASYNC_UPDATE;
gst_bin_add (GST_BIN (comp), source2);
+ if (async)
+ check_start_stop_duration (comp, 0, 1 * GST_SECOND, 1 * GST_SECOND);
+ ENABLE_ASYNC_UPDATE;
check_start_stop_duration (comp, 0, 2 * GST_SECOND, 2 * GST_SECOND);
ASSERT_OBJECT_REFCOUNT (source2, "source2", 1);
@@ -467,7 +502,9 @@ GST_START_TEST (test_one_bin_after_other)
/* Remove first source */
gst_object_ref (source1);
+ DISABLE_ASYNC_UPDATE;
gst_bin_remove (GST_BIN (comp), source1);
+ ENABLE_ASYNC_UPDATE;
check_start_stop_duration (comp, 1 * GST_SECOND, 2 * GST_SECOND,
1 * GST_SECOND);
@@ -475,7 +512,12 @@ GST_START_TEST (test_one_bin_after_other)
/* Re-add first source */
+ DISABLE_ASYNC_UPDATE;
gst_bin_add (GST_BIN (comp), source1);
+ if (async)
+ check_start_stop_duration (comp, 1 * GST_SECOND, 2 * GST_SECOND,
+ 1 * GST_SECOND);
+ ENABLE_ASYNC_UPDATE;
check_start_stop_duration (comp, 0, 2 * GST_SECOND, 2 * GST_SECOND);
gst_object_unref (source1);
@@ -601,8 +643,65 @@ GST_START_TEST (test_one_bin_after_other)
g_free (collect);
}
+
+GST_START_TEST (test_time_duration)
+{
+ test_time_duration_full (FALSE);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_time_duration_async)
+{
+ test_time_duration_full (TRUE);
+}
+
GST_END_TEST;
+GST_START_TEST (test_one_after_other)
+{
+ test_one_after_other_full (FALSE);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_one_after_other_async)
+{
+ test_one_after_other_full (TRUE);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_one_under_another)
+{
+ test_one_under_another_full (FALSE);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_one_under_another_async)
+{
+ test_one_under_another_full (TRUE);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_one_bin_after_other)
+{
+ test_one_bin_after_other_full (FALSE);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_one_bin_after_other_async)
+{
+ test_one_bin_after_other_full (TRUE);
+}
+
+GST_END_TEST;
+
+
+
Suite *
gnonlin_suite (void)
{
@@ -612,9 +711,13 @@ gnonlin_suite (void)
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_time_duration);
+ tcase_add_test (tc_chain, test_time_duration_async);
tcase_add_test (tc_chain, test_one_after_other);
+ tcase_add_test (tc_chain, test_one_after_other_async);
tcase_add_test (tc_chain, test_one_under_another);
+ tcase_add_test (tc_chain, test_one_under_another_async);
tcase_add_test (tc_chain, test_one_bin_after_other);
+ tcase_add_test (tc_chain, test_one_bin_after_other_full);
return s;
}