mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
element: Check for an activated pad before adding, not a non-flushing one
The pad could be activated but flushing because of a FLUSH_START event. That's not what we're looking for here, we want to check for activated pads. https://bugzilla.gnome.org/show_bug.cgi?id=758928
This commit is contained in:
parent
1751835838
commit
c247117990
1 changed files with 6 additions and 9 deletions
|
@ -647,7 +647,7 @@ gboolean
|
|||
gst_element_add_pad (GstElement * element, GstPad * pad)
|
||||
{
|
||||
gchar *pad_name;
|
||||
gboolean flushing;
|
||||
gboolean active;
|
||||
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
||||
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
|
||||
|
@ -657,7 +657,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);
|
||||
active = GST_PAD_IS_ACTIVE (pad);
|
||||
GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_NEED_PARENT);
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
|
||||
|
@ -671,16 +671,13 @@ 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 ||
|
||||
/* check for active pads */
|
||||
if (!active && (GST_STATE (element) > GST_STATE_READY ||
|
||||
GST_STATE_NEXT (element) == GST_STATE_PAUSED)) {
|
||||
g_warning ("adding flushing pad '%s' to running element '%s', you need to "
|
||||
g_warning ("adding inactive pad '%s' to running element '%s', you need to "
|
||||
"use gst_pad_set_active(pad,TRUE) before adding it.",
|
||||
GST_STR_NULL (pad_name), GST_ELEMENT_NAME (element));
|
||||
/* unset flushing */
|
||||
GST_OBJECT_LOCK (pad);
|
||||
GST_PAD_UNSET_FLUSHING (pad);
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
gst_pad_set_active (pad, TRUE);
|
||||
}
|
||||
|
||||
g_free (pad_name);
|
||||
|
|
Loading…
Reference in a new issue