From 7754d8d7bab96808ee53366c5765361b26e6bb39 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 23 May 2011 18:15:00 +0200 Subject: [PATCH] transform: fixes for bufferpool handling Don't error out when the allocation query returns success. Do bufferpool query after we pushed the caps event downstream so that we can get a good bufferpool suggestion. Also proxy the bufferpool query downstream when we operate in in_place mode. --- libs/gst/base/gstbasetransform.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index 43821220b5..3a57bac2b6 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -778,7 +778,7 @@ gst_base_transform_do_bufferpool (GstBaseTransform * trans, GstCaps * outcaps) /* find a pool for the negotiated caps now */ query = gst_query_new_allocation (outcaps, TRUE); - if (gst_pad_peer_query (trans->srcpad, query)) + if (!gst_pad_peer_query (trans->srcpad, query)) goto query_failed; /* we got configuration from our peer, parse them */ @@ -861,11 +861,6 @@ gst_base_transform_configure_caps (GstBaseTransform * trans, GstCaps * in, ret = klass->set_caps (trans, in, out); } - if (ret) { - /* try to get a pool when needed */ - gst_base_transform_do_bufferpool (trans, out); - } - trans->negotiated = ret; return ret; @@ -1251,6 +1246,11 @@ gst_base_transform_setcaps (GstBaseTransform * trans, GstPad * pad, } } + if (ret) { + /* try to get a pool when needed */ + gst_base_transform_do_bufferpool (trans, othercaps); + } + done: if (otherpeer) gst_object_unref (otherpeer); @@ -1301,9 +1301,11 @@ gst_base_transform_query (GstPad * pad, GstQuery * query) goto done; GST_BASE_TRANSFORM_LOCK (trans); - passthrough = trans->passthrough; + passthrough = trans->passthrough || trans->always_in_place; GST_BASE_TRANSFORM_UNLOCK (trans); + GST_DEBUG_OBJECT (trans, "passthrough %d", passthrough); + if (passthrough) ret = gst_pad_peer_query (otherpad, query); else @@ -1439,7 +1441,7 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans, if (*out_buf == NULL) { if (trans->passthrough) { - GST_DEBUG_OBJECT (trans, "Avoiding pad alloc"); + GST_DEBUG_OBJECT (trans, "Reusing input buffer"); *out_buf = in_buf; } else if (trans->priv->srcpool) { GST_DEBUG_OBJECT (trans, "using pool alloc");