libs/gst/base/gstbasetransform.c: Only call downstream buffer_alloc if transform element is passthrough or always_in_...

Original commit message from CVS:
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_buffer_alloc):
Only call downstream buffer_alloc if transform element is passthrough
or always_in_place. Closes #350449.
diff --git a/ChangeLog b/ChangeLog
index 1078ef8..145d6be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-08-21  Edward Hervey  <edward@fluendo.com>
+
+	* libs/gst/base/gstbasetransform.c:
+	(gst_base_transform_buffer_alloc):
+	Only call downstream buffer_alloc if transform element is passthrough
+	or always_in_place. Closes #350449.
+
 2006-08-20  Stefan Kost  <ensonic@users.sf.net>
 
 	* ChangeLog:
diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c
index 6d501a9..2d2b014 100644
--- a/libs/gst/base/gstbasetransform.c
+++ b/libs/gst/base/gstbasetransform.c
@@ -1160,9 +1160,14 @@
     /* let the default allocator handle it... */
     GST_DEBUG_OBJECT (trans, "not configured");
     gst_buffer_replace (buf, NULL);
-    /* ...by calling alloc_buffer without setting caps on the src pad, which
-     * will force negotiation in the chain function. */
-    res = gst_pad_alloc_buffer (trans->srcpad, offset, size, caps, buf);
+    if (trans->passthrough || trans->always_in_place) {
+      /* ...by calling alloc_buffer without setting caps on the src pad, which
+       * will force negotiation in the chain function. */
+      res = gst_pad_alloc_buffer (trans->srcpad, offset, size, caps, buf);
+    } else {
+      /* ...by letting the default handler create a buffer */
+      res = GST_FLOW_OK;
+    }
     goto done;
   }
 unknown_size:
@@ -1170,9 +1175,14 @@
     /* let the default allocator handle it... */
     GST_DEBUG_OBJECT (trans, "unknown size");
     gst_buffer_replace (buf, NULL);
-    /* ...by calling alloc_buffer without setting caps on the src pad, which
-     * will force negotiation in the chain function. */
-    res = gst_pad_alloc_buffer (trans->srcpad, offset, size, caps, buf);
+    if (trans->passthrough || trans->always_in_place) {
+      /* ...by calling alloc_buffer without setting caps on the src pad, which
+       * will force negotiation in the chain function. */
+      res = gst_pad_alloc_buffer (trans->srcpad, offset, size, caps, buf);
+    } else {
+      /* ...by letting the default handler create a buffer */
+      res = GST_FLOW_OK;
+    }
     goto done;
   }
 }