From a24a3be13b81c5d0080c061edf61daece6341f95 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 13 Aug 2013 18:20:27 +0200 Subject: gnlcomposition: Drop any buffer flowing from a source when updating pipeline There is a race where we can have an EOS from the element which srcpad is our ghost pad but other elements upstream are still outputing data and we flush the element so its pads have no segment info anymore, and we end up having warning about flow before segement event. The solution here is that we do not let any data flowing when we are updating the pipeline. --- gnl/gnlcomposition.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gnl/gnlcomposition.c b/gnl/gnlcomposition.c index 830ff2d..006ed4e 100644 --- a/gnl/gnlcomposition.c +++ b/gnl/gnlcomposition.c @@ -1210,6 +1210,11 @@ pad_blocked (GstPad * pad, GstPadProbeInfo * info, GnlComposition * comp) { GST_DEBUG_OBJECT (comp, "Pad : %s:%s", GST_DEBUG_PAD_NAME (pad)); + /* When updating the pipeline, do not let data flowing */ + if (comp->priv->stackvalid == FALSE && + GST_IS_BUFFER (GST_PAD_PROBE_INFO_DATA (info))) + return GST_PAD_PROBE_DROP; + return GST_PAD_PROBE_OK; } @@ -2587,6 +2592,9 @@ update_pipeline (GnlComposition * comp, GstClockTime currenttime, stack = get_clean_toplevel_stack (comp, ¤ttime, &new_start, &new_stop); samestack = are_same_stacks (priv->current, stack); + /* invalidate the stack while modifying it */ + priv->stackvalid = FALSE; + /* 2. If stacks are different, unlink/relink objects */ if (!samestack) todeactivate = compare_relink_stack (comp, stack, modify); @@ -2622,9 +2630,6 @@ update_pipeline (GnlComposition * comp, GstClockTime currenttime, g_node_destroy (priv->current); priv->current = NULL; - /* invalidate the stack while modifying it */ - priv->stackvalid = FALSE; - /* 5. deactivate unused elements */ if (todeactivate) { GList *tmp; -- cgit v1.2.3