From 564bd8d4730fd934e8a37c764a7655f8a87736f1 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 11 Aug 2016 09:42:32 -0400 Subject: [PATCH] layer: Make sure to resync priorities on commit In case effects have been added priorites might become wrong, but until the timeline is not commited, it does not matter. Make sure all priorities are correct before commiting compositions Differential Revision: https://phabricator.freedesktop.org/D1277 --- ges/ges-internal.h | 4 ++++ ges/ges-layer.c | 5 +---- ges/ges-timeline.c | 9 +++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ges/ges-internal.h b/ges/ges-internal.h index b6353657c2..78e0fe8995 100644 --- a/ges/ges-internal.h +++ b/ges/ges-internal.h @@ -331,6 +331,10 @@ G_GNUC_INTERNAL void ges_clip_set_moving_from_layer (GESClip *clip G_GNUC_INTERNAL GESTrackElement* ges_clip_create_track_element (GESClip *clip, GESTrackType type); G_GNUC_INTERNAL GList* ges_clip_create_track_elements (GESClip *clip, GESTrackType type); +/**************************************************** + * GESLayer * + ****************************************************/ +G_GNUC_INTERNAL gboolean ges_layer_resync_priorities (GESLayer * layer); /**************************************************** * GESTrackElement * diff --git a/ges/ges-layer.c b/ges/ges-layer.c index ca780656cb..81602945f3 100644 --- a/ges/ges-layer.c +++ b/ges/ges-layer.c @@ -225,7 +225,7 @@ ges_layer_init (GESLayer * self) * Resyncs the priorities of the clips controlled by @layer. * This method */ -static gboolean +gboolean ges_layer_resync_priorities (GESLayer * layer) { GstClockTime next_reset = 0; @@ -398,7 +398,6 @@ ges_layer_set_priority (GESLayer * layer, guint priority) layer->priv->priority = priority; layer->min_nle_priority = (priority * LAYER_HEIGHT) + MIN_NLE_PRIO; layer->max_nle_priority = ((priority + 1) * LAYER_HEIGHT) + MIN_NLE_PRIO; - ges_layer_resync_priorities (layer); } @@ -599,8 +598,6 @@ ges_layer_add_clip (GESLayer * layer, GESClip * clip) _set_priority0 (GES_TIMELINE_ELEMENT (clip), LAYER_HEIGHT - 1); } - /* If the clip has an acceptable priority, we just let it with its current - * priority */ ges_layer_resync_priorities (layer); ges_timeline_element_set_timeline (GES_TIMELINE_ELEMENT (clip), layer->timeline); diff --git a/ges/ges-timeline.c b/ges/ges-timeline.c index 1efde965cf..603e995bc4 100644 --- a/ges/ges-timeline.c +++ b/ges/ges-timeline.c @@ -3388,8 +3388,13 @@ ges_timeline_commit_unlocked (GESTimeline * timeline) GST_DEBUG_OBJECT (timeline, "commiting changes"); for (tmp = timeline->layers; tmp; tmp = tmp->next) { - _create_transitions_on_layer (timeline, GES_LAYER (tmp->data), - NULL, NULL, _find_transition_from_auto_transitions); + GESLayer *layer = tmp->data; + + _create_transitions_on_layer (timeline, layer, NULL, NULL, + _find_transition_from_auto_transitions); + + /* Ensure clip priorities are correct after an edit */ + ges_layer_resync_priorities (layer); } timeline->priv->expected_commited =