gst/gstbin.c: Fix a big bug that was breaking pipelines like sinesrc ! { queue !...
authorJulien Moutte <julien@moutte.net>
Sun, 15 Feb 2004 19:05:59 +0000 (19:05 +0000)
committerJulien Moutte <julien@moutte.net>
Sun, 15 Feb 2004 19:05:59 +0000 (19:05 +0000)
Original commit message from CVS:
2004-02-15  Julien MOUTTE  <julien@moutte.net>

* gst/gstbin.c: (gst_bin_change_state), (gst_bin_iterate): Fix a big
bug that was breaking pipelines like sinesrc ! { queue ! osssink } when
an error was thrown by osssink. Basically a state change failure for
an element in a different scheduling group was considered as successfull        , which means that caps nego was going on and weird stuff happened. Like        i wrote in the comment there, if someone want to revert that please
drop me a mail explaining why because i really see no point in keeping
that broken behaviour there.
* gst/gstqueue.c: (gst_queue_get): Add a safety check as the queue CAN
be empty, we then return NULL which will trigger a nice error when
pulling from the pad.

ChangeLog
gst/gstbin.c
gst/gstqueue.c
plugins/elements/gstqueue.c

index 459ada2..ab7fb40 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2004-02-15  Julien MOUTTE  <julien@moutte.net>
+
+       * gst/gstbin.c: (gst_bin_change_state), (gst_bin_iterate): Fix a big
+       bug that was breaking pipelines like sinesrc ! { queue ! osssink } when
+       an error was thrown by osssink. Basically a state change failure for
+       an element in a different scheduling group was considered as successfull
+       , which means that caps nego was going on and weird stuff happened. Like
+       i wrote in the comment there, if someone want to revert that please
+       drop me a mail explaining why because i really see no point in keeping
+       that broken behaviour there.
+       * gst/gstqueue.c: (gst_queue_get): Add a safety check as the queue CAN
+       be empty, we then return NULL which will trigger a nice error when 
+       pulling from the pad.
+
 2004-02-13  David Schleef  <ds@schleef.org>
 
        * libs/gst/control/dparam.c: (gst_dparam_class_init),
index c2a2012..0dd559d 100644 (file)
@@ -723,14 +723,13 @@ gst_bin_change_state (GstElement * element)
                   GST_ELEMENT_NAME (child), pending, gst_element_state_get_name (pending));
 
        gst_element_set_state (child, old_child_state);
-       /* FIXME, this is legacy code, a failed state change of a child should
-        * return a failure in all cases */
-       if (GST_ELEMENT_SCHED (child) == GST_ELEMENT_SCHED (element)) {
-          /* try to reset it to what is was */
-          GST_STATE_PENDING (element) = old_state;
-
-         return GST_STATE_FAILURE;
-       }
+       /* There was a check for elements being in the same scheduling group
+          here. Removed by dolphy <julien@moutte.net>. No matter the 
+          scheduling group we should always return a failure. This change
+          seems to work on my machine and fixes tons of issues. If anyone
+          want to revert please tell me what it breaks first, Thanks. */
+       GST_STATE_PENDING (element) = old_state;
+       return GST_STATE_FAILURE;
        break;
       case GST_STATE_ASYNC:
        GST_CAT_DEBUG (GST_CAT_STATES, "child '%s' is changing state asynchronously",
@@ -738,6 +737,8 @@ gst_bin_change_state (GstElement * element)
        have_async = TRUE;
        break;
       case GST_STATE_SUCCESS:
+        GST_CAT_DEBUG (GST_CAT_STATES, "child '%s' changed state to %d(%s) successfully",
+                  GST_ELEMENT_NAME (child), pending, gst_element_state_get_name (pending));
         break; 
     }
   }
@@ -1134,4 +1135,3 @@ gst_bin_iterate (GstBin *bin)
 
   return running;
 }
-
index b9f5e1c..239b1a8 100644 (file)
@@ -719,6 +719,9 @@ restart:
   data = g_queue_pop_head (queue->queue);
   GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
                      "retrieved data %p from queue", data);
+  
+  if (data == NULL)
+    return NULL;
 
   if (GST_IS_BUFFER (data)) {
     /* Update statistics */
index b9f5e1c..239b1a8 100644 (file)
@@ -719,6 +719,9 @@ restart:
   data = g_queue_pop_head (queue->queue);
   GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, queue,
                      "retrieved data %p from queue", data);
+  
+  if (data == NULL)
+    return NULL;
 
   if (GST_IS_BUFFER (data)) {
     /* Update statistics */