basetransform: fix negotiation regression
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>
Tue, 19 Apr 2011 23:35:04 +0000 (20:35 -0300)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 21 Apr 2011 13:04:49 +0000 (14:04 +0100)
Fixup patch for 83597767b169dd6c39a07b6144a650c1f098825a

Use a separate variable for knowing if a pad alloc has been made
instead of checking for the flow return that might not be the
result of the pad alloc

https://bugzilla.gnome.org/show_bug.cgi?id=648220

libs/gst/base/gstbasetransform.c

index 71cc9b9..ccf0802 100644 (file)
@@ -1715,6 +1715,7 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
   GstBaseTransformClass *klass;
   GstBaseTransformPrivate *priv;
   GstFlowReturn res;
+  gboolean alloced = FALSE;
   gboolean proxy, suggest, same_caps;
   GstCaps *sink_suggest = NULL;
   guint size_suggest;
@@ -1921,6 +1922,7 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
     res = gst_pad_alloc_buffer (trans->srcpad, offset, size, caps, buf);
     if (res != GST_FLOW_OK)
       goto alloc_failed;
+    alloced = TRUE;
 
     /* check if the caps changed */
     newcaps = GST_BUFFER_CAPS (*buf);
@@ -1966,7 +1968,7 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
   if (sink_suggest)
     gst_caps_unref (sink_suggest);
 
-  if (res == GST_FLOW_OK) {
+  if (res == GST_FLOW_OK && alloced) {
     /* just alloc'ed a buffer, so we only want to do this again if we
      * received a buffer */
     GST_DEBUG_OBJECT (trans, "Cleaning force alloc");