[gst-cvs] gnonlin: gnlcomposition: Add a stackvalid protected variable to know if we can expose the stack.

Edward Hervey bilboed at kemper.freedesktop.org
Sat Apr 18 23:25:00 PDT 2009


Module: gnonlin
Branch: master
Commit: 31ff821c59a0bc4e89ac712df6082608a60b3d8c
URL:    http://cgit.freedesktop.org/gstreamer/gnonlin/commit/?id=31ff821c59a0bc4e89ac712df6082608a60b3d8c

Author: Edward Hervey <bilboed at bilboed.com>
Date:   Fri Apr 17 13:15:24 2009 +0200

gnlcomposition: Add a stackvalid protected variable to know if we can expose the stack.

The problem is that checking if comp->private->current is available isn't good enough,
since we might be in the middle of activating the stack.

---

 gnl/gnlcomposition.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/gnl/gnlcomposition.c b/gnl/gnlcomposition.c
index 9e9341d..358ab74 100644
--- a/gnl/gnlcomposition.c
+++ b/gnl/gnlcomposition.c
@@ -84,6 +84,11 @@ struct _GnlCompositionPrivate
 
   GnlObject *defaultobject;
 
+  /* TRUE if the stack is valid.
+   * This is meant to prevent the top-level pad to be unblocked before the stack
+   * is fully done. Protected by OBJECTS_LOCK */
+  gboolean stackvalid;
+
   /*
      current segment seek start/stop time. 
      Reconstruct pipeline ONLY if seeking outside of those values
@@ -437,6 +442,8 @@ gnl_composition_reset (GnlComposition * comp)
     g_node_destroy (comp->private->current);
   comp->private->current = NULL;
 
+  comp->private->stackvalid = FALSE;
+
   if (comp->private->ghostpad) {
     gnl_object_remove_ghost_pad ((GnlObject *) comp, comp->private->ghostpad);
     comp->private->ghostpad = NULL;
@@ -1491,7 +1498,8 @@ no_more_pads_object_cb (GstElement * element, GnlComposition * comp)
           comp);
     }
 
-    if (comp->private->current && comp->private->waitingpads == 0) {
+    if (comp->private->current && (comp->private->waitingpads == 0)
+        && comp->private->stackvalid) {
       tpad = get_src_pad (GST_ELEMENT (comp->private->current->data));
 
       /* There are no more waiting pads for the currently configured timeline */
@@ -1972,6 +1980,9 @@ update_pipeline (GnlComposition * comp, GstClockTime currenttime,
       g_node_destroy (comp->private->current);
     comp->private->current = NULL;
 
+    /* invalidate the stack while modifying it */
+    comp->private->stackvalid = FALSE;
+
     COMP_OBJECTS_UNLOCK (comp);
 
     if (deactivate) {
@@ -2008,6 +2019,8 @@ update_pipeline (GnlComposition * comp, GstClockTime currenttime,
 
       COMP_OBJECTS_LOCK (comp);
 
+      comp->private->stackvalid = TRUE;
+
       /* 1. Create new seek event for newly configured timeline stack */
       if (samestack && (startchanged || stopchanged))
         event =





More information about the Gstreamer-commits mailing list