From b79e5e35081a85be4e0cd881871861065d83b95e Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 14 May 2020 00:56:40 -0400 Subject: [PATCH] nlecomposition: Add stack initialization action after setting our state Otherwise there is a pretty rare race where we get the _initialize_stack_func executed leading to the stack set up and the source pushing buffers before the composition source pad is activated, and a STREAM_ERROR is reported as we end up pushing a buffer to a flushing pad. Thanks rr chaos mode for showing that improbable race Part-of: --- plugins/nle/nlecomposition.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/nle/nlecomposition.c b/plugins/nle/nlecomposition.c index a136a99d0d..000acf1ef5 100644 --- a/plugins/nle/nlecomposition.c +++ b/plugins/nle/nlecomposition.c @@ -2637,14 +2637,6 @@ nle_composition_change_state (GstElement * element, GstStateChange transition) _set_all_children_state (comp, GST_STATE_READY); _start_task (comp); break; - case GST_STATE_CHANGE_READY_TO_PAUSED: - /* state-lock all elements */ - GST_DEBUG_OBJECT (comp, - "Setting all children to READY and locking their state"); - - _add_update_compo_action (comp, G_CALLBACK (_initialize_stack_func), - COMP_UPDATE_STACK_INITIALIZE); - break; case GST_STATE_CHANGE_PAUSED_TO_READY: _stop_task (comp); @@ -2682,6 +2674,14 @@ nle_composition_change_state (GstElement * element, GstStateChange transition) } switch (transition) { + case GST_STATE_CHANGE_READY_TO_PAUSED: + /* state-lock all elements */ + GST_DEBUG_OBJECT (comp, + "Setting all children to READY and locking their state"); + + _add_update_compo_action (comp, G_CALLBACK (_initialize_stack_func), + COMP_UPDATE_STACK_INITIALIZE); + break; case GST_STATE_CHANGE_PAUSED_TO_READY: comp->priv->tearing_down_stack = FALSE; nle_composition_reset (comp);