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.
This commit is contained in:
Wim Taymans 2011-05-23 18:15:00 +02:00
parent 8380949994
commit 7754d8d7ba

View file

@ -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");