From 849c17d326436993ad9adfe9531a0d2662ca7394 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Thu, 8 May 2008 05:55:34 +0000 Subject: [PATCH] libs/gst/base/gstbasetransform.c: Don't passthrough buffer allocation too easily if the caps change. Original commit message from CVS: Based on a patch by: Sjoerd Simons * libs/gst/base/gstbasetransform.c: (gst_base_transform_buffer_alloc): Don't passthrough buffer allocation too easily if the caps change. This breaks when working in passthrough mode and upstream changes it's caps. Fixes bug #526768. --- ChangeLog | 10 ++++++++++ libs/gst/base/gstbasetransform.c | 10 ++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9e6ce216c..4f1256423b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-05-08 Sebastian Dröge + + Based on a patch by: Sjoerd Simons + + * libs/gst/base/gstbasetransform.c: + (gst_base_transform_buffer_alloc): + Don't passthrough buffer allocation too easily if the caps change. + This breaks when working in passthrough mode and upstream changes + it's caps. Fixes bug #526768. + 2008-05-07 Ole André Vadla Ravnås * gst/gstinfo.c (gst_debug_log_valist): diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index 53e66309a0..c1c7b604d4 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -1209,12 +1209,14 @@ not_configured: /* let the default allocator handle it... */ GST_DEBUG_OBJECT (trans, "not configured"); gst_buffer_replace (buf, NULL); - if (trans->passthrough) { - /* ...by calling alloc_buffer without setting caps on the src pad, which - * will force negotiation in the chain function. */ + + if (gst_pad_accept_caps (trans->srcpad, caps) + && gst_pad_peer_accept_caps (trans->srcpad, caps)) { + /* ...by seeing if the downstream elements can handle this */ res = gst_pad_alloc_buffer (trans->srcpad, offset, size, caps, buf); } else { - /* ...by letting the default handler create a buffer */ + /* If not fall back on the default handler and let things be + * renegotiated in the chain function */ res = GST_FLOW_OK; } goto done;