gst/gstpad.c: Only sanity-check the buffer size if requested_caps == buffer_caps (ie. don't take pad caps into accoun...

Original commit message from CVS:
* gst/gstpad.c: (gst_pad_alloc_buffer_full):
Only sanity-check the buffer size if requested_caps == buffer_caps
(ie. don't take pad caps into account, they're not relevant here)
This commit is contained in:
Tim-Philipp Müller 2008-07-29 15:32:11 +00:00
parent f4caf88854
commit 20d11b6fe0
2 changed files with 15 additions and 8 deletions

View file

@ -1,3 +1,9 @@
2008-07-29 Tim-Philipp Müller <tim.muller at collabora co uk>
* gst/gstpad.c: (gst_pad_alloc_buffer_full):
Only sanity-check the buffer size if requested_caps == buffer_caps
(ie. don't take pad caps into account, they're not relevant here)
2008-07-29 Stefan Kost <ensonic@users.sf.net>
* plugins/elements/gsttee.c:

View file

@ -2725,6 +2725,7 @@ gst_pad_alloc_buffer_full (GstPad * pad, guint64 offset, gint size,
{
GstPad *peer;
GstFlowReturn ret;
GstCaps *newcaps;
gboolean caps_changed;
g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
@ -2752,29 +2753,29 @@ gst_pad_alloc_buffer_full (GstPad * pad, guint64 offset, gint size,
goto peer_error;
/* FIXME, move capnego this into a base class? */
caps = GST_BUFFER_CAPS (*buf);
newcaps = GST_BUFFER_CAPS (*buf);
/* Lock for checking caps, pretty pointless as the _pad_push() function might
* change it concurrently, one of the problems with automatic caps setting in
* pad_alloc_and_set_caps. Worst case, if does a check too much, but only
* when there is heavy renegotiation going on in both directions. */
GST_OBJECT_LOCK (pad);
caps_changed = caps && caps != GST_PAD_CAPS (pad);
caps_changed = newcaps && newcaps != GST_PAD_CAPS (pad);
GST_OBJECT_UNLOCK (pad);
/* we got a new datatype on the pad, see if it can handle it */
if (G_UNLIKELY (caps_changed)) {
GST_DEBUG_OBJECT (pad,
"caps changed from %" GST_PTR_FORMAT " to %p %" GST_PTR_FORMAT,
GST_PAD_CAPS (pad), caps, caps);
if (G_UNLIKELY (!gst_pad_configure_src (pad, caps, setcaps)))
GST_PAD_CAPS (pad), newcaps, newcaps);
if (G_UNLIKELY (!gst_pad_configure_src (pad, newcaps, setcaps)))
goto not_negotiated;
} else {
/* sanity check (only if caps haven't changed) */
if (G_UNLIKELY (GST_BUFFER_SIZE (*buf) < size))
goto wrong_size_fallback;
}
/* sanity check (only if caps are the same) */
if (G_LIKELY (newcaps == caps) && G_UNLIKELY (GST_BUFFER_SIZE (*buf) < size))
goto wrong_size_fallback;
return ret;
flushed: