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
This commit is contained in:
Stian Selnes 2015-09-21 15:22:19 +02:00 committed by Sebastian Dröge
parent 64a152439c
commit 0fbf1d3eb7
2 changed files with 16 additions and 6 deletions

View file

@ -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;
}

View file

@ -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;
}