]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/commitdiff
collectpads: Don't forward FLUSH_STOP if some input streams are still flushing.
authorEdward Hervey <bilboed@bilboed.com>
Mon, 29 Jun 2009 09:26:57 +0000 (11:26 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Sun, 5 Jul 2009 19:24:42 +0000 (21:24 +0200)
This guarantees that only one FLUSH_STOP event (the last one) will be sent
downstream when a flushing seek is being done through collectpads.

libs/gst/base/gstcollectpads.c

index c8b7aaf8c620ea0357a25de8ece552801e3a8180..c1a21f28bca41959da57cc413149c963e8e1d4c7 100644 (file)
@@ -506,6 +506,27 @@ gst_collect_pads_collect_range (GstCollectPads * pads, guint64 offset,
   return GST_FLOW_NOT_SUPPORTED;
 }
 
+static gboolean
+gst_collect_pads_is_flushing (GstCollectPads * pads)
+{
+  GSList *walk = pads->data;
+  gboolean res = TRUE;
+
+  GST_COLLECT_PADS_PAD_LOCK (pads);
+  while (walk) {
+    GstCollectData *cdata = walk->data;
+
+    if (cdata->abidata.ABI.flushing)
+      goto done;
+    walk = g_slist_next (walk);
+  }
+
+  res = FALSE;
+done:
+  GST_COLLECT_PADS_PAD_UNLOCK (pads);
+  return res;
+}
+
 /* FIXME, I think this function is used to work around bad behaviour
  * of elements that add pads to themselves without activating them.
  *
@@ -1123,8 +1144,11 @@ gst_collect_pads_event (GstPad * pad, GstEvent * event)
       }
       GST_OBJECT_UNLOCK (pads);
 
-      /* forward event */
-      goto forward;
+      if (!gst_collect_pads_is_flushing (pads))
+        /* forward event if all pads are no longer flushing */
+        goto forward;
+      gst_event_unref (event);
+      goto done;
     }
     case GST_EVENT_EOS:
     {