bin: reset the EOS detection machinery after sending an EOS message
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Thu, 2 Feb 2012 17:18:22 +0000 (17:18 +0000)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Fri, 3 Feb 2012 11:23:28 +0000 (11:23 +0000)
This will allow detecting further EOS, for instance after looping
a stream without changing states.

https://bugzilla.gnome.org/show_bug.cgi?id=668289

gst/gstbin.c

index f3d1b56..479917f 100644 (file)
@@ -3051,6 +3051,16 @@ bin_do_eos (GstBin * bin)
       && g_atomic_int_compare_and_exchange (&bin->priv->posted_eos, FALSE,
           TRUE)) {
     GstMessage *tmessage;
+
+    /* Clear out any further messages, and reset posted_eos so we can
+       detect any new EOS that happens (eg, after a seek). Since all
+       sinks have now posted an EOS, there will be no further EOS events
+       seen unless there is a new logical EOS */
+    GST_OBJECT_LOCK (bin);
+    bin_remove_messages (bin, NULL, GST_MESSAGE_EOS);
+    bin->priv->posted_eos = FALSE;
+    GST_OBJECT_UNLOCK (bin);
+
     tmessage = gst_message_new_eos (GST_OBJECT_CAST (bin));
     gst_message_set_seqnum (tmessage, seqnum);
     GST_DEBUG_OBJECT (bin,