diff --git a/ges/ges-layer.c b/ges/ges-layer.c index ad33c02139..80e669e1a2 100644 --- a/ges/ges-layer.c +++ b/ges/ges-layer.c @@ -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); diff --git a/tests/check/python/test_timeline.py b/tests/check/python/test_timeline.py index 045c0e05c5..72a81b06f1 100644 --- a/tests/check/python/test_timeline.py +++ b/tests/check/python/test_timeline.py @@ -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