composition: Do not try to paused the task that could have been stopped
authorThibault Saunier <tsaunier@gnome.org>
Mon, 28 Jul 2014 18:24:50 +0000 (20:24 +0200)
committerThibault Saunier <tsaunier@gnome.org>
Fri, 31 Oct 2014 10:58:11 +0000 (11:58 +0100)
There was a race where we ended up trying to update the pipeline and
stop our children task at the exact moment where we were actually
setting its state to PAUSED. Take the composition lock and make sure
that can't happen

gnl/gnlcomposition.c

index 1bfe590..ae95323 100644 (file)
@@ -2748,7 +2748,16 @@ update_pipeline (GnlComposition * comp, GstClockTime currenttime, gint32 seqnum,
         (GstPadProbeCallback) _is_update_done_cb, ucompo,
         _free_update_compo_data);
 
+    GST_OBJECT_LOCK (comp);
+    if (comp->task == NULL) {
+      GST_INFO_OBJECT (comp,
+          "No task set, it must have been stopped, returning");
+      GST_OBJECT_UNLOCK (comp);
+      return FALSE;
+    }
+
     gst_task_pause (comp->task);
+    GST_OBJECT_UNLOCK (comp);
   }
 
   /* Activate stack */