gst/: Set pads to FLUSHING when they are created. Check, warn and fix when a demuxer...
authorWim Taymans <wim.taymans@gmail.com>
Fri, 15 Dec 2006 16:01:58 +0000 (16:01 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Fri, 15 Dec 2006 16:01:58 +0000 (16:01 +0000)
Original commit message from CVS:
* gst/gstelement.c: (gst_element_add_pad):
* gst/gstghostpad.c: (gst_ghost_pad_new_full):
* gst/gstpad.c: (gst_pad_init):
Set pads to FLUSHING when they are created. Check, warn and fix when a
demuxer adds an inactive pad to itself when running. Fixes #339326.

ChangeLog
gst/gstelement.c
gst/gstghostpad.c
gst/gstpad.c

index aa427c8..e7485cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2006-12-15  Wim Taymans  <wim@fluendo.com>
 
+       * gst/gstelement.c: (gst_element_add_pad):
+       * gst/gstghostpad.c: (gst_ghost_pad_new_full):
+       * gst/gstpad.c: (gst_pad_init):
+       Set pads to FLUSHING when they are created. Check, warn and fix when a
+       demuxer adds an inactive pad to itself when running. Fixes #339326.
+
+2006-12-15  Wim Taymans  <wim@fluendo.com>
+
        * gst/gstelement.c: (gst_element_class_init),
        (gst_element_default_send_event), (gst_element_send_event),
        (gst_element_default_query), (gst_element_query):
index 38dba2e..6a31406 100644 (file)
@@ -612,6 +612,7 @@ gboolean
 gst_element_add_pad (GstElement * element, GstPad * pad)
 {
   gchar *pad_name;
+  gboolean flushing;
 
   g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
   g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
@@ -621,6 +622,7 @@ gst_element_add_pad (GstElement * element, GstPad * pad)
   pad_name = g_strdup (GST_PAD_NAME (pad));
   GST_CAT_INFO_OBJECT (GST_CAT_ELEMENT_PADS, element, "adding pad '%s'",
       GST_STR_NULL (pad_name));
+  flushing = GST_PAD_IS_FLUSHING (pad);
   GST_OBJECT_UNLOCK (pad);
 
   /* then check to see if there's already a pad by that name here */
@@ -633,6 +635,17 @@ gst_element_add_pad (GstElement * element, GstPad * pad)
               GST_OBJECT_CAST (element))))
     goto had_parent;
 
+  /* check for flushing pads */
+  if (flushing && (GST_STATE (element) > GST_STATE_READY ||
+          GST_STATE_NEXT (element) == GST_STATE_PAUSED)) {
+    g_warning ("adding flushing pad '%s' to running element '%s'",
+        GST_STR_NULL (pad_name), GST_ELEMENT_NAME (element));
+    /* unset flushing */
+    GST_OBJECT_LOCK (pad);
+    GST_PAD_UNSET_FLUSHING (pad);
+    GST_OBJECT_UNLOCK (pad);
+  }
+
   g_free (pad_name);
 
   /* add it to the list */
index 1bcfe8a..7546e12 100644 (file)
@@ -833,7 +833,7 @@ gst_ghost_pad_new_full (const gchar * name, GstPadDirection dir,
         g_object_new (GST_TYPE_PROXY_PAD, "name", NULL,
         "direction", otherdir, NULL);
   }
-  /* GST_PAD_UNSET_FLUSHING (internal); */
+  GST_PAD_UNSET_FLUSHING (internal);
 
   /* Set directional padfunctions for internal pad */
   if (dir == GST_PAD_SRC) {
index 7031b3d..b3a32ba 100644 (file)
@@ -352,12 +352,7 @@ gst_pad_init (GstPad * pad)
   pad->do_buffer_signals = 0;
   pad->do_event_signals = 0;
 
-#if 0
   GST_PAD_SET_FLUSHING (pad);
-#else
-  /* FIXME, should be set flushing initially, see #339326 */
-  GST_PAD_UNSET_FLUSHING (pad);
-#endif
 
   pad->preroll_lock = g_mutex_new ();
   pad->preroll_cond = g_cond_new ();