adder: send flush_stop to match flush_start
authorStefan Kost <ensonic@users.sf.net>
Tue, 19 May 2009 13:45:56 +0000 (16:45 +0300)
committerStefan Kost <ensonic@users.sf.net>
Tue, 19 May 2009 13:49:35 +0000 (16:49 +0300)
Adder was relying that something else sends a flush stop. When using adder with
a livesource it was not getting a flush_stop and thus all pads downstream where
keept flushing. Mark a pending flush_stop and send it when we are working on
the new segment back in the streaming thread.

gst/adder/gstadder.c
gst/adder/gstadder.h

index 2905d3f..0861997 100644 (file)
@@ -672,6 +672,8 @@ gst_adder_src_event (GstPad * pad, GstEvent * event)
       else
         adder->segment_position = 0;
       adder->segment_pending = TRUE;
+      adder->flush_stop_pending =
+          ((flags & GST_SEEK_FLAG_FLUSH) == GST_SEEK_FLAG_FLUSH);
       GST_OBJECT_UNLOCK (adder->collect);
       GST_DEBUG_OBJECT (adder, "forwarding seek event: %" GST_PTR_FORMAT,
           event);
@@ -719,6 +721,7 @@ gst_adder_sink_event (GstPad * pad, GstEvent * event)
        * and downstream (using our source pad, the bastard!).
        */
       adder->segment_pending = TRUE;
+      adder->flush_stop_pending = FALSE;
       break;
     default:
       break;
@@ -1006,6 +1009,10 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
           adder->timestamp, adder->segment_position);
     }
   }
+  if (adder->flush_stop_pending) {
+    gst_pad_push_event (adder->srcpad, gst_event_new_flush_stop ());
+    adder->flush_stop_pending = FALSE;
+  }
 
   /* set timestamps on the output buffer */
   GST_BUFFER_TIMESTAMP (outbuf) = adder->timestamp;
index 62075c0..d656e9d 100644 (file)
@@ -87,6 +87,8 @@ struct _GstAdder {
   gboolean        segment_pending;
   guint64         segment_position;
   gdouble         segment_rate;
+  /* src event handling */
+  gboolean        flush_stop_pending;
 };
 
 struct _GstAdderClass {