track: Do not commit ourselves automatically when changing state from wrong thread
authorThibault Saunier <tsaunier@igalia.com>
Fri, 24 Apr 2020 20:46:50 +0000 (16:46 -0400)
committerThibault Saunier <tsaunier@igalia.com>
Mon, 27 Apr 2020 21:58:40 +0000 (17:58 -0400)
The user is responsible to commit the timeline from the right thread
in that case and in the case of gesdemux, the loaded timeline is filling
gaps automatically when the project is set loaded.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/166>

ges/ges-track.c

index d9613d9..2d3f7c5 100644 (file)
@@ -434,7 +434,10 @@ dispose_trackelements_foreach (GESTrackElement * trackelement, GESTrack * track)
 static GstStateChangeReturn
 ges_track_change_state (GstElement * element, GstStateChange transition)
 {
-  if (transition == GST_STATE_CHANGE_READY_TO_PAUSED)
+  GESTrack *track = GES_TRACK (element);
+
+  if (transition == GST_STATE_CHANGE_READY_TO_PAUSED &&
+      track->priv->valid_thread == g_thread_self ())
     track_resort_and_fill_gaps (GES_TRACK (element));
 
   return GST_ELEMENT_CLASS (ges_track_parent_class)->change_state (element,