Fix buffer_alloc in ximagesink

Remove some useless debug info that reported wrong image sizes.

When upstream does not accept out suggested size, fall back to allocating an
image of the requested width/height instead of the currently configured size.
The problem is that an image is reused from the pool because the width/height
match but the caps on the new buffer are the requested caps with possibly
different height/width resulting in errors.
This commit is contained in:
Wim Taymans 2009-02-02 13:30:42 +01:00
parent 9996aab207
commit e7f910e0fc

View file

@ -231,8 +231,8 @@ gst_ximage_buffer_finalize (GstXImageBuffer * ximage)
} }
if (!recycled) if (!recycled)
GST_MINI_OBJECT_CLASS (ximage_buffer_parent_class)-> GST_MINI_OBJECT_CLASS (ximage_buffer_parent_class)->finalize
finalize (GST_MINI_OBJECT (ximage)); (GST_MINI_OBJECT (ximage));
beach: beach:
return; return;
@ -1364,8 +1364,8 @@ gst_ximagesink_getcaps (GstBaseSink * bsink)
/* get a template copy and add the pixel aspect ratio */ /* get a template copy and add the pixel aspect ratio */
caps = caps =
gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SINK (ximagesink)-> gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SINK
sinkpad)); (ximagesink)->sinkpad));
for (i = 0; i < gst_caps_get_size (caps); ++i) { for (i = 0; i < gst_caps_get_size (caps); ++i) {
GstStructure *structure = gst_caps_get_structure (caps, i); GstStructure *structure = gst_caps_get_structure (caps, i);
@ -1742,24 +1742,19 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
* function returns true. */ * function returns true. */
if (gst_pad_peer_accept_caps (GST_VIDEO_SINK_PAD (ximagesink), if (gst_pad_peer_accept_caps (GST_VIDEO_SINK_PAD (ximagesink),
desired_caps)) { desired_caps)) {
gint bpp;
bpp = size / height / width;
/* we will not alloc a buffer of the new suggested caps. Make sure /* we will not alloc a buffer of the new suggested caps. Make sure
* we also unref this new caps after we set it on the buffer. */ * we also unref this new caps after we set it on the buffer. */
alloc_caps = desired_caps; alloc_caps = desired_caps;
alloc_unref = TRUE; alloc_unref = TRUE;
width = result.w; width = result.w;
height = result.h; height = result.h;
size = bpp * width * height; GST_DEBUG ("peer pad accepts our desired caps %" GST_PTR_FORMAT,
GST_DEBUG ("peer pad accepts our desired caps %" GST_PTR_FORMAT desired_caps);
" buffer size is now %d bytes", desired_caps, size);
} else { } else {
GST_DEBUG ("peer pad does not accept our desired caps %" GST_PTR_FORMAT, GST_DEBUG ("peer pad does not accept our desired caps %" GST_PTR_FORMAT,
desired_caps); desired_caps);
/* we alloc a buffer with the original incomming caps */ /* we alloc a buffer with the original incomming caps already in the
width = GST_VIDEO_SINK_WIDTH (ximagesink); * width and height variables */
height = GST_VIDEO_SINK_HEIGHT (ximagesink);
} }
} }
} }