summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2009-05-08 12:36:35 +0200
committerEdward Hervey <bilboed@bilboed.com>2009-05-08 12:36:35 +0200
commit407de04c67c1c354a539f47e3da4a49c1142d8a9 (patch)
treec9c1275615eac533b0ae1a614dc21dd3905d1c99
parentd6e84eafc8b22c05d3da8849a4cdf46045a58f78 (diff)
gnlcomposition: Update start/duration/stop even with update==False.
The reason behind this is that updating the lists and those properties are decently simple/fast to do it at that time. The internal pipeline will still not be updated if update == False.
-rw-r--r--gnl/gnlcomposition.c46
-rw-r--r--tests/check/simple.c14
2 files changed, 20 insertions, 40 deletions
diff --git a/gnl/gnlcomposition.c b/gnl/gnlcomposition.c
index 5a592b3..58368f2 100644
--- a/gnl/gnlcomposition.c
+++ b/gnl/gnlcomposition.c
@@ -717,13 +717,6 @@ gnl_composition_set_update (GnlComposition * comp, gboolean 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))
@@ -2217,11 +2210,6 @@ 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);
@@ -2229,6 +2217,12 @@ object_start_stop_priority_changed (GnlObject * object,
comp->private->objects_stop = g_list_sort
(comp->private->objects_stop, (GCompareFunc) objects_stop_compare);
+ if (!comp->private->can_update) {
+ comp->private->update_required = TRUE;
+ update_start_stop_duration (comp);
+ return;
+ }
+
/* Update pipeline if needed */
if (comp->private->current &&
(OBJECT_IN_ACTIVE_SEGMENT (comp, object) ||
@@ -2421,13 +2415,13 @@ gnl_composition_add_object (GstBin * bin, GstElement * element)
/* If we added within currently configured segment OR the pipeline was *
* previously empty, THEN update pipeline */
- 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;
+ if (G_LIKELY (update_required && comp->private->can_update))
+ update_pipeline (comp, curpos, TRUE, TRUE, TRUE);
+ else {
+ if (!comp->private->can_update)
+ comp->private->update_required |= update_required;
+ update_start_stop_duration (comp);
+ }
beach:
gst_object_unref (element);
@@ -2492,13 +2486,13 @@ gnl_composition_remove_object (GstBin * bin, GstElement * element)
/* If we removed within currently configured segment, or it was the default source, *
* update pipeline */
- 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;
+ if (G_LIKELY (comp->private->can_update && update_required))
+ update_pipeline (comp, curpos, TRUE, TRUE, TRUE);
+ else {
+ if (!comp->private->can_update)
+ comp->private->update_required |= update_required;
+ update_start_stop_duration (comp);
+ }
ret = GST_BIN_CLASS (parent_class)->remove_element (bin, element);
diff --git a/tests/check/simple.c b/tests/check/simple.c
index 9e02c79..cb6e981 100644
--- a/tests/check/simple.c
+++ b/tests/check/simple.c
@@ -42,8 +42,6 @@ test_time_duration_full (gboolean async)
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);
@@ -53,8 +51,6 @@ test_time_duration_full (gboolean async)
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);
@@ -65,8 +61,6 @@ test_time_duration_full (gboolean async)
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);
@@ -77,9 +71,6 @@ test_time_duration_full (gboolean async)
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);
@@ -492,8 +483,6 @@ test_one_bin_after_other_full (gboolean async)
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);
@@ -514,9 +503,6 @@ test_one_bin_after_other_full (gboolean async)
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);