mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
nlecomposition: Suppress error from child during sync state with parent
This commit is to ensure cleanup internal elements on state change failure. nlecomposition posts its own error message after cleanup child. If we don't suppress child error, meanwhile, an application triggered downward state change (resulting from child error message) might be able to reach nlecomposition before internal cleaning child up. That eventually results to downward state change failure.
This commit is contained in:
parent
4c94de3c38
commit
50e40ba621
1 changed files with 21 additions and 10 deletions
|
@ -196,6 +196,7 @@ struct _NleCompositionPrivate
|
||||||
gboolean waiting_serialized_query_or_buffer;
|
gboolean waiting_serialized_query_or_buffer;
|
||||||
|
|
||||||
gboolean tearing_down_stack;
|
gboolean tearing_down_stack;
|
||||||
|
gboolean suppress_child_error;
|
||||||
|
|
||||||
NleUpdateStackReason updating_reason;
|
NleUpdateStackReason updating_reason;
|
||||||
};
|
};
|
||||||
|
@ -940,22 +941,29 @@ static void
|
||||||
nle_composition_handle_message (GstBin * bin, GstMessage * message)
|
nle_composition_handle_message (GstBin * bin, GstMessage * message)
|
||||||
{
|
{
|
||||||
NleComposition *comp = (NleComposition *) bin;
|
NleComposition *comp = (NleComposition *) bin;
|
||||||
|
NleCompositionPrivate *priv = comp->priv;
|
||||||
|
|
||||||
if (comp->priv->tearing_down_stack) {
|
if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR &&
|
||||||
if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR) {
|
(priv->tearing_down_stack || priv->suppress_child_error)) {
|
||||||
GST_FIXME_OBJECT (comp, "Dropping %" GST_PTR_FORMAT " message from "
|
GST_FIXME_OBJECT (comp, "Dropping %" GST_PTR_FORMAT " message from "
|
||||||
" %" GST_PTR_FORMAT " being teared down to READY",
|
" %" GST_PTR_FORMAT " tearing down: %d, suppressing error: %d",
|
||||||
message, GST_MESSAGE_SRC (message));
|
message, GST_MESSAGE_SRC (message), priv->tearing_down_stack,
|
||||||
}
|
priv->suppress_child_error);
|
||||||
|
goto drop;
|
||||||
|
} else if (comp->priv->tearing_down_stack) {
|
||||||
GST_DEBUG_OBJECT (comp, "Dropping message %" GST_PTR_FORMAT " from "
|
GST_DEBUG_OBJECT (comp, "Dropping message %" GST_PTR_FORMAT " from "
|
||||||
"object being teared down to READY!", message);
|
"object being teared down to READY!", message);
|
||||||
gst_message_unref (message);
|
goto drop;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_BIN_CLASS (parent_class)->handle_message (bin, message);
|
GST_BIN_CLASS (parent_class)->handle_message (bin, message);
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
drop:
|
||||||
|
gst_message_unref (message);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2902,9 +2910,11 @@ resync_state:
|
||||||
gst_element_set_locked_state (priv->current_bin, FALSE);
|
gst_element_set_locked_state (priv->current_bin, FALSE);
|
||||||
|
|
||||||
GST_DEBUG ("going back to parent state");
|
GST_DEBUG ("going back to parent state");
|
||||||
|
priv->suppress_child_error = TRUE;
|
||||||
if (!gst_element_sync_state_with_parent (priv->current_bin)) {
|
if (!gst_element_sync_state_with_parent (priv->current_bin)) {
|
||||||
gst_element_set_locked_state (priv->current_bin, TRUE);
|
gst_element_set_locked_state (priv->current_bin, TRUE);
|
||||||
gst_element_set_state (priv->current_bin, GST_STATE_NULL);
|
gst_element_set_state (priv->current_bin, GST_STATE_NULL);
|
||||||
|
priv->suppress_child_error = FALSE;
|
||||||
|
|
||||||
GST_ELEMENT_ERROR (comp, CORE, STATE_CHANGE, (NULL),
|
GST_ELEMENT_ERROR (comp, CORE, STATE_CHANGE, (NULL),
|
||||||
("Could not sync %" GST_PTR_FORMAT " state with parent",
|
("Could not sync %" GST_PTR_FORMAT " state with parent",
|
||||||
|
@ -2912,6 +2922,7 @@ resync_state:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priv->suppress_child_error = FALSE;
|
||||||
GST_DEBUG ("gone back to parent state");
|
GST_DEBUG ("gone back to parent state");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue