summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStian Selnes <stian@pexip.com>2015-09-21 15:22:19 +0200
committerSebastian Dröge <sebastian@centricular.com>2015-09-24 12:14:57 +0200
commit0fbf1d3eb7feaa753cf1d0ec03546f854dd1f037 (patch)
tree3cc0715ae4838f01b1d9b4b89a516aa8248f9d9b
parent64a152439c8a4b3ff493e8290bd442de02f08681 (diff)
downloadgstreamer-0fbf1d3eb7feaa753cf1d0ec03546f854dd1f037.tar.gz
bin: element: Ignore activate result for removed pads on state change
This fixes a race where a state change may return failure if it has request pads that are deactivated and removed (and thus have no parent) at the same time as the element changes state and (de)activates its pads. https://bugzilla.gnome.org/show_bug.cgi?id=755342
-rw-r--r--gst/gstbin.c11
-rw-r--r--gst/gstelement.c11
2 files changed, 16 insertions, 6 deletions
diff --git a/gst/gstbin.c b/gst/gstbin.c
index 3f684bc4fb..9cea0b30e3 100644
--- a/gst/gstbin.c
+++ b/gst/gstbin.c
@@ -2371,15 +2371,20 @@ was_busy:
}
/* gst_iterator_fold functions for pads_activate
- * Stop the iterator if activating one pad failed. */
+ * Stop the iterator if activating one pad failed, but only if that pad
+ * has not been removed from the element. */
static gboolean
activate_pads (const GValue * vpad, GValue * ret, gboolean * active)
{
GstPad *pad = g_value_get_object (vpad);
gboolean cont = TRUE;
- if (!(cont = gst_pad_set_active (pad, *active)))
- g_value_set_boolean (ret, FALSE);
+ if (!gst_pad_set_active (pad, *active)) {
+ if (GST_PAD_PARENT (pad) != NULL) {
+ cont = FALSE;
+ g_value_set_boolean (ret, FALSE);
+ }
+ }
return cont;
}
diff --git a/gst/gstelement.c b/gst/gstelement.c
index c681194d5b..ccb3734088 100644
--- a/gst/gstelement.c
+++ b/gst/gstelement.c
@@ -2679,15 +2679,20 @@ invalid_return:
}
/* gst_iterator_fold functions for pads_activate
- * Stop the iterator if activating one pad failed. */
+ * Stop the iterator if activating one pad failed, but only if that pad
+ * has not been removed from the element. */
static gboolean
activate_pads (const GValue * vpad, GValue * ret, gboolean * active)
{
GstPad *pad = g_value_get_object (vpad);
gboolean cont = TRUE;
- if (!(cont = gst_pad_set_active (pad, *active)))
- g_value_set_boolean (ret, FALSE);
+ if (!gst_pad_set_active (pad, *active)) {
+ if (GST_PAD_PARENT (pad) != NULL) {
+ cont = FALSE;
+ g_value_set_boolean (ret, FALSE);
+ }
+ }
return cont;
}