libs/gst/base/gstbasetransform.c: Check if requested caps are the same as the sinks caps IF

Original commit message from CVS:
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_buffer_alloc):
Check if requested caps are the same as the sinks caps IF
->have_same_caps is TRUE. If they are not, act as if have_same_caps
is FALSE.
This fixes the renegotiation issues stated in #352827.
This commit is contained in:
Edward Hervey 2006-09-16 12:49:02 +00:00
parent 147373d4a7
commit 63b1a81cf8
2 changed files with 28 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2006-09-16 Edward Hervey <edward@fluendo.com>
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_buffer_alloc):
Check if requested caps are the same as the sinks caps IF
->have_same_caps is TRUE. If they are not, act as if have_same_caps
is FALSE.
This fixes the renegotiation issues stated in #352827.
2006-09-16 Thomas Vander Stichele <thomas at apestaart dot org>
* configure.ac:

View file

@ -1046,6 +1046,7 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
GstBaseTransform *trans;
GstFlowReturn res;
guint new_size;
gboolean issinkcaps = TRUE;
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
@ -1061,9 +1062,26 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
else
GST_DEBUG_OBJECT (trans, "... and offset %" G_GUINT64_FORMAT, offset);
/* if have_same_caps was previously set to TRUE we need to double check if it
* hasn't changed */
if (trans->have_same_caps) {
GstCaps *sinkcaps;
GST_OBJECT_LOCK (trans->sinkpad);
sinkcaps = GST_PAD_CAPS (trans->sinkpad);
issinkcaps = sinkcaps && (gst_caps_is_equal (sinkcaps, caps));
GST_OBJECT_UNLOCK (trans->sinkpad);
}
/* before any buffers are pushed, have_same_caps is TRUE; allocating can trigger
* a renegotiation and change that to FALSE */
if (trans->have_same_caps) {
/* bilboed: This seems wrong, from all debug logs, have_same_caps is
* initialized to FALSE */
/* checking against trans->have_same_caps is not enough !! It should also
* check to see if the requested caps are equal to the sink caps */
if (trans->have_same_caps && issinkcaps) {
/* request a buffer with the same caps */
GST_DEBUG_OBJECT (trans, "requesting buffer with same caps, size %d", size);