Commit dea6f0df authored by Thibault Saunier's avatar Thibault Saunier 🌵
Browse files

layer: Resort clips before syncing priorities

We set the priorities making the assumption that `start_clips` is properly
ordered by start!

Fixes https://gitlab.gnome.org/GNOME/pitivi/issues/2254
parent 044c2a2d
Pipeline #16664 passed with stages
in 15 minutes and 45 seconds
......@@ -234,6 +234,9 @@ ges_layer_resync_priorities_by_type (GESLayer * layer,
GList *tmp;
GESTimelineElement *element;
layer->priv->clips_start =
g_list_sort (layer->priv->clips_start,
(GCompareFunc) element_start_compare);
for (tmp = layer->priv->clips_start; tmp; tmp = tmp->next) {
element = GES_TIMELINE_ELEMENT (tmp->data);
......@@ -783,6 +786,9 @@ ges_layer_get_clips_in_interval (GESLayer * layer, GstClockTime start,
g_return_val_if_fail (GES_IS_LAYER (layer), NULL);
layer->priv->clips_start =
g_list_sort (layer->priv->clips_start,
(GCompareFunc) element_start_compare);
for (tmp = layer->priv->clips_start; tmp; tmp = tmp->next) {
clip_intersects = FALSE;
clip_start = ges_timeline_element_get_start (tmp->data);
......
......@@ -244,3 +244,17 @@ class TestTransitions(GESSimpleTimelineTest):
# transition and once for the audio transition.
self.assertEqual(
signals, ["notify::start", "clip-added", "clip-added"])
class TestPriorities(GESSimpleTimelineTest):
def test_clips_priorities(self):
clip = self.add_clip(0, 0, 100)
clip1 = self.add_clip(100, 0, 100)
self.timeline.commit()
self.assertLess(clip.props.priority, clip1.props.priority)
clip.props.start = 101
self.timeline.commit()
self.assertGreater(clip.props.priority, clip1.props.priority)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment