clip: make auto-transitions less expensive when adding to track

Only check the overlaps with the actual track element that was just added
to the track. This reduces the tree traversal by one order.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/169>
This commit is contained in:
Henry Wilkes 2020-04-21 15:06:03 +01:00
parent cdac205db6
commit 30a821e136
3 changed files with 16 additions and 2 deletions

View file

@ -2611,8 +2611,8 @@ ges_clip_add_child_to_track (GESClip * clip, GESTrackElement * child,
} }
if (GES_IS_SOURCE (el)) if (GES_IS_SOURCE (el))
timeline_tree_create_transitions (timeline_get_tree (timeline), timeline_tree_create_transitions_for_track_element (timeline_get_tree
ges_timeline_find_auto_transition); (timeline), el, ges_timeline_find_auto_transition);
return el; return el;
} }

View file

@ -2079,6 +2079,16 @@ create_transitions (GNode * node,
return FALSE; return FALSE;
} }
void
timeline_tree_create_transitions_for_track_element (GNode * root,
GESTrackElement * element, GESTreeGetAutoTransitionFunc get_auto_transition)
{
GNode *node = find_node (root, element);
g_assert (node);
create_transitions (node, get_auto_transition);
}
void void
timeline_tree_create_transitions (GNode * root, timeline_tree_create_transitions (GNode * root,
GESTreeGetAutoTransitionFunc get_auto_transition) GESTreeGetAutoTransitionFunc get_auto_transition)

View file

@ -54,6 +54,10 @@ typedef GESAutoTransition *
GESTrackElement * next, GESTrackElement * next,
GstClockTime transition_duration); GstClockTime transition_duration);
void
timeline_tree_create_transitions_for_track_element (GNode * root,
GESTrackElement * element,
GESTreeGetAutoTransitionFunc get_auto_transition);
void timeline_tree_create_transitions (GNode *root, void timeline_tree_create_transitions (GNode *root,
GESTreeGetAutoTransitionFunc get_auto_transition); GESTreeGetAutoTransitionFunc get_auto_transition);