diff options
-rw-r--r-- | gnl/gnlcomposition.c | 46 | ||||
-rw-r--r-- | tests/check/simple.c | 14 |
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); |