adder: ensure sending a flush-stop after flush-start
authorStefan Sauer <ensonic@users.sf.net>
Thu, 21 Feb 2013 07:15:45 +0000 (08:15 +0100)
committerStefan Sauer <ensonic@users.sf.net>
Thu, 21 Feb 2013 09:11:32 +0000 (10:11 +0100)
Previously adder was only sending the flush-stop, when it saw the flushing seek.
If one sends a flushing see direcly to an element upstream of adder, it would
fail to unflush the downstream pads.

gst/adder/gstadder.c

index bddb786..e390bf9 100644 (file)
@@ -817,6 +817,16 @@ gst_adder_sink_event (GstCollectPads * pads, GstCollectData * pad,
       gst_event_unref (event);
       event = NULL;
     }
+    case GST_EVENT_FLUSH_START:
+      /* ensure that we'll eventually send a flush-stop, when we have received a
+       * flush-start (e.g. after a flushing seek directly sent to an element) */
+      if (g_atomic_int_compare_and_exchange (&adder->flush_stop_pending,
+              FALSE, TRUE)) {
+        /* discard flush start events, as we forwarded one already when handing the
+         * flushing seek on the sink pad */
+        discard = TRUE;
+      }
+      break;
     case GST_EVENT_FLUSH_STOP:
       /* we received a flush-stop. We will only forward it when
        * flush_stop_pending is set, and we will unset it then.