ges: Ensure that assets are added to project before adding clip to timeline

It is the right ordering and in Pitivi we set the project size
when adding the first (relevant) asset, meaning that our code to
reposition clips would kick in (in the unit tests) if we do not respect
that ordering.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/176>
This commit is contained in:
Thibault Saunier 2020-05-18 08:49:53 -04:00
parent e89411527a
commit cb02c15d57

View file

@ -1734,6 +1734,12 @@ ges_timeline_add_clip (GESTimeline * timeline, GESClip * clip)
g_signal_connect (clip, "child-removed",
G_CALLBACK (clip_track_element_removed_cb), timeline);
GST_DEBUG ("Making sure that the asset is in our project");
project =
GES_PROJECT (ges_extractable_get_asset (GES_EXTRACTABLE (timeline)));
ges_project_add_asset (project,
ges_extractable_get_asset (GES_EXTRACTABLE (clip)));
if (ges_clip_is_moving_from_layer (clip)) {
GST_DEBUG ("Clip %p moving from one layer to another, not creating "
"TrackElement", clip);
@ -1743,12 +1749,6 @@ ges_timeline_add_clip (GESTimeline * timeline, GESClip * clip)
ret = add_object_to_tracks (timeline, clip, NULL);
}
GST_DEBUG ("Making sure that the asset is in our project");
project =
GES_PROJECT (ges_extractable_get_asset (GES_EXTRACTABLE (timeline)));
ges_project_add_asset (project,
ges_extractable_get_asset (GES_EXTRACTABLE (clip)));
GST_DEBUG ("Done");
return ret;