gst/base/gstbasesink.c: Only error is an error.
authorWim Taymans <wim.taymans@gmail.com>
Fri, 30 Sep 2005 08:00:12 +0000 (08:00 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Fri, 30 Sep 2005 08:00:12 +0000 (08:00 +0000)
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_change_state):
Only error is an error.

* gst/gstbin.c: (gst_bin_change_state):
Better debugging.

* gst/gstpad.c: (gst_pad_alloc_buffer), (gst_pad_chain):
Also call pad_block in pad alloc.

* gst/gstutils.c: (gst_flow_get_name):
Better debugging.

ChangeLog
common
gst/base/gstbasesink.c
gst/gstbin.c
gst/gstpad.c
gst/gstutils.c
libs/gst/base/gstbasesink.c

index 92ffbdb..b44de28 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2005-09-30  Wim Taymans  <wim@fluendo.com>
+
+       * gst/base/gstbasesink.c: (gst_base_sink_change_state):
+       Only error is an error.
+
+       * gst/gstbin.c: (gst_bin_change_state):
+       Better debugging.
+
+       * gst/gstpad.c: (gst_pad_alloc_buffer), (gst_pad_chain):
+       Also call pad_block in pad alloc.
+
+       * gst/gstutils.c: (gst_flow_get_name):
+       Better debugging.
+
 2005-09-29  Tim-Philipp Müller  <tim at centricular dot net>
 
        * gst/base/gstbasesrc.c: (gst_base_src_class_init),
diff --git a/common b/common
index e6246e8..7d17546 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit e6246e87e86c75b2c9c00d0748f0cd2332295eaa
+Subproject commit 7d175466d3319fe55327608ea1f7a20619ab5634
index 7b6811a..d2fc8c5 100644 (file)
@@ -1449,8 +1449,7 @@ gst_base_sink_change_state (GstElement * element, GstStateChange transition)
     GstStateChangeReturn bret;
 
     bret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
-    if (bret != GST_STATE_CHANGE_SUCCESS)
+    if (bret == GST_STATE_CHANGE_FAILURE)
       goto activate_failed;
   }
 
index d5b05b0..bcc0d8c 100644 (file)
@@ -1419,11 +1419,13 @@ restart:
         break;
       }
       case GST_ITERATOR_RESYNC:
+        GST_CAT_DEBUG (GST_CAT_STATES, "iterator doing resync");
         gst_iterator_resync (it);
         goto restart;
         break;
       default:
       case GST_ITERATOR_DONE:
+        GST_CAT_DEBUG (GST_CAT_STATES, "iterator done");
         done = TRUE;
         break;
     }
index 86d5dc4..b7c5294 100644 (file)
@@ -117,6 +117,7 @@ static void gst_pad_set_property (GObject * object, guint prop_id,
 static void gst_pad_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
+static void handle_pad_block (GstPad * pad);
 static GstCaps *gst_pad_get_caps_unlocked (GstPad * pad);
 static void gst_pad_set_pad_template (GstPad * pad, GstPadTemplate * templ);
 static gboolean gst_pad_activate_default (GstPad * pad);
@@ -2366,13 +2367,14 @@ gst_pad_alloc_buffer (GstPad * pad, guint64 offset, gint size, GstCaps * caps,
   GstPadBufferAllocFunction bufferallocfunc;
   gboolean caps_changed;
 
-  GST_DEBUG_OBJECT (pad, "offset %" G_GUINT64_FORMAT, offset);
-
   g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
   g_return_val_if_fail (GST_PAD_IS_SRC (pad), GST_FLOW_ERROR);
   g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
 
   GST_LOCK (pad);
+  while (G_UNLIKELY (GST_PAD_IS_BLOCKED (pad)))
+    handle_pad_block (pad);
+
   if (G_UNLIKELY ((peer = GST_PAD_PEER (pad)) == NULL))
     goto no_peer;
 
@@ -2387,14 +2389,17 @@ gst_pad_alloc_buffer (GstPad * pad, guint64 offset, gint size, GstCaps * caps,
   if (G_UNLIKELY (GST_PAD_IS_FLUSHING (peer)))
     goto flushing;
 
-  GST_CAT_DEBUG (GST_CAT_PADS,
-      "calling bufferallocfunc &%s (@%p) of peer pad %s:%s for size %d ...",
-      GST_DEBUG_FUNCPTR_NAME (bufferallocfunc),
-      &bufferallocfunc, GST_DEBUG_PAD_NAME (peer), size);
-  if (offset == GST_BUFFER_OFFSET_NONE)
-    GST_CAT_DEBUG (GST_CAT_PADS, "... and offset NONE");
-  else
-    GST_CAT_DEBUG (GST_CAT_PADS, "... and offset %" G_GUINT64_FORMAT, offset);
+  if (offset == GST_BUFFER_OFFSET_NONE) {
+    GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
+        "calling bufferallocfunc &%s (@%p) of peer pad %s:%s for size %d offset NONE",
+        GST_DEBUG_FUNCPTR_NAME (bufferallocfunc),
+        &bufferallocfunc, GST_DEBUG_PAD_NAME (peer), size);
+  } else {
+    GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
+        "calling bufferallocfunc &%s (@%p) of peer pad %s:%s for size %d offset %"
+        G_GUINT64_FORMAT, GST_DEBUG_FUNCPTR_NAME (bufferallocfunc),
+        &bufferallocfunc, GST_DEBUG_PAD_NAME (peer), size, offset);
+  }
   GST_UNLOCK (peer);
 
   ret = bufferallocfunc (peer, offset, size, caps, buf);
@@ -2469,7 +2474,7 @@ peer_error:
   {
     gst_object_unref (peer);
     GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
-        "alloc function retured error %d", ret);
+        "alloc function retured error %s", gst_flow_get_name (ret));
     return ret;
   }
 }
@@ -3007,8 +3012,9 @@ gst_pad_chain (GstPad * pad, GstBuffer * buffer)
   ret = chainfunc (pad, buffer);
 
   GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
-      "called chainfunction &%s of pad %s:%s, returned %d",
-      GST_DEBUG_FUNCPTR_NAME (chainfunc), GST_DEBUG_PAD_NAME (pad), ret);
+      "called chainfunction &%s of pad %s:%s, returned %s",
+      GST_DEBUG_FUNCPTR_NAME (chainfunc), GST_DEBUG_PAD_NAME (pad),
+      gst_flow_get_name (ret));
 
   GST_STREAM_UNLOCK (pad);
 
index 3c9952f..baac963 100644 (file)
@@ -1758,25 +1758,25 @@ gst_flow_get_name (GstFlowReturn ret)
 {
   switch (ret) {
     case GST_FLOW_RESEND:
-      return "need to resend buffer";
+      return "RESEND_BUFFER";
     case GST_FLOW_OK:
       return "OK";
       /* expected failures */
     case GST_FLOW_NOT_LINKED:
-      return "pad not linked";
+      return "NOT_LINKED";
     case GST_FLOW_WRONG_STATE:
-      return "pad in wrong state";
+      return "WRONG_STATE";
       /* error cases */
     case GST_FLOW_UNEXPECTED:
-      return "unexpected data on pad";
+      return "UNEXPECTED";
     case GST_FLOW_NOT_NEGOTIATED:
-      return "pad not negotiated";
+      return "NOT_NEGOTIATED";
     case GST_FLOW_ERROR:
-      return "fatal error occured";
+      return "ERROR";
     case GST_FLOW_NOT_SUPPORTED:
-      return "unsupported function called";
+      return "NOT_SUPPORTED";
     default:
-      return "unknown error";
+      return "UNKNOWN error";
   }
 }
 
index 7b6811a..d2fc8c5 100644 (file)
@@ -1449,8 +1449,7 @@ gst_base_sink_change_state (GstElement * element, GstStateChange transition)
     GstStateChangeReturn bret;
 
     bret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
-    if (bret != GST_STATE_CHANGE_SUCCESS)
+    if (bret == GST_STATE_CHANGE_FAILURE)
       goto activate_failed;
   }