track: Avoid various sorting operations before timeline commit

These are showing up in performance profile of 1000+ clips looped addition.
All this is done at commit time as well, so let that do only one update and
sorting.
This commit is contained in:
Mart Raudsepp 2019-04-12 17:30:14 +03:00 committed by Thibault Saunier
parent 6a0f2358ce
commit 0c592ad6ac

View file

@ -280,14 +280,6 @@ update_field (GQuark field_id, const GValue * value, GstStructure * original)
}
/* callbacks */
static void
sort_track_elements_cb (GESTrackElement * child,
GParamSpec * arg G_GNUC_UNUSED, GESTrack * track)
{
g_sequence_sort (track->priv->trackelements_by_start,
(GCompareDataFunc) element_start_compare, NULL);
}
static void
_ghost_nlecomposition_srcpad (GESTrack * track)
{
@ -380,8 +372,6 @@ remove_object_internal (GESTrack * track, GESTrackElement * object)
}
}
g_signal_handlers_disconnect_by_func (object, sort_track_elements_cb, NULL);
ges_track_element_set_track (object, NULL);
ges_timeline_element_set_timeline (GES_TIMELINE_ELEMENT (object), NULL);
@ -987,15 +977,6 @@ ges_track_add_element (GESTrack * track, GESTrackElement * object)
g_signal_emit (track, ges_track_signals[TRACK_ELEMENT_ADDED], 0,
GES_TRACK_ELEMENT (object));
g_signal_connect (GES_TRACK_ELEMENT (object), "notify::start",
G_CALLBACK (sort_track_elements_cb), track);
g_signal_connect (GES_TRACK_ELEMENT (object), "notify::duration",
G_CALLBACK (sort_track_elements_cb), track);
g_signal_connect (GES_TRACK_ELEMENT (object), "notify::priority",
G_CALLBACK (sort_track_elements_cb), track);
return TRUE;
}
@ -1052,7 +1033,6 @@ ges_track_remove_element (GESTrack * track, GESTrackElement * object)
it = g_hash_table_lookup (priv->trackelements_iter, object);
g_sequence_remove (it);
track_resort_and_fill_gaps (track);
if (remove_object_internal (track, object) == TRUE) {
ges_timeline_element_set_timeline (GES_TIMELINE_ELEMENT (object), NULL);