Commit 1affbe8e authored by Wim Taymans's avatar Wim Taymans

gst/: Set pads to FLUSHING when they are created. Check, warn and fix when a...

gst/: Set pads to FLUSHING when they are created. Check, warn and fix when a demuxer adds an inactive pad to itself w...

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.
parent 0ad3d72c
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> 2006-12-15 Wim Taymans <wim@fluendo.com>
* gst/gstelement.c: (gst_element_class_init), * gst/gstelement.c: (gst_element_class_init),
......
...@@ -612,6 +612,7 @@ gboolean ...@@ -612,6 +612,7 @@ gboolean
gst_element_add_pad (GstElement * element, GstPad * pad) gst_element_add_pad (GstElement * element, GstPad * pad)
{ {
gchar *pad_name; gchar *pad_name;
gboolean flushing;
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE); g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
g_return_val_if_fail (GST_IS_PAD (pad), FALSE); g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
...@@ -621,6 +622,7 @@ gst_element_add_pad (GstElement * element, GstPad * pad) ...@@ -621,6 +622,7 @@ gst_element_add_pad (GstElement * element, GstPad * pad)
pad_name = g_strdup (GST_PAD_NAME (pad)); pad_name = g_strdup (GST_PAD_NAME (pad));
GST_CAT_INFO_OBJECT (GST_CAT_ELEMENT_PADS, element, "adding pad '%s'", GST_CAT_INFO_OBJECT (GST_CAT_ELEMENT_PADS, element, "adding pad '%s'",
GST_STR_NULL (pad_name)); GST_STR_NULL (pad_name));
flushing = GST_PAD_IS_FLUSHING (pad);
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
/* then check to see if there's already a pad by that name here */ /* 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) ...@@ -633,6 +635,17 @@ gst_element_add_pad (GstElement * element, GstPad * pad)
GST_OBJECT_CAST (element)))) GST_OBJECT_CAST (element))))
goto had_parent; 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); g_free (pad_name);
/* add it to the list */ /* add it to the list */
......
...@@ -833,7 +833,7 @@ gst_ghost_pad_new_full (const gchar * name, GstPadDirection dir, ...@@ -833,7 +833,7 @@ gst_ghost_pad_new_full (const gchar * name, GstPadDirection dir,
g_object_new (GST_TYPE_PROXY_PAD, "name", NULL, g_object_new (GST_TYPE_PROXY_PAD, "name", NULL,
"direction", otherdir, NULL); "direction", otherdir, NULL);
} }
/* GST_PAD_UNSET_FLUSHING (internal); */ GST_PAD_UNSET_FLUSHING (internal);
/* Set directional padfunctions for internal pad */ /* Set directional padfunctions for internal pad */
if (dir == GST_PAD_SRC) { if (dir == GST_PAD_SRC) {
......
...@@ -352,12 +352,7 @@ gst_pad_init (GstPad * pad) ...@@ -352,12 +352,7 @@ gst_pad_init (GstPad * pad)
pad->do_buffer_signals = 0; pad->do_buffer_signals = 0;
pad->do_event_signals = 0; pad->do_event_signals = 0;
#if 0
GST_PAD_SET_FLUSHING (pad); 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_lock = g_mutex_new ();
pad->preroll_cond = g_cond_new (); pad->preroll_cond = g_cond_new ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment