[gstreamer-bugs] [Bug 577346] [xvimagesink] Playback failure with certain XVImage sizes

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Fri Apr 24 15:07:22 PDT 2009

If you have any questions why you received this email, please see the text at
the end of this email. Replies to this email are NOT read, please see the text
at the end of this email. You can add comments to this bug at:

  GStreamer | gst-plugins-base | Ver: 0.10.16

------- Comment #4 from Steve Magoun  2009-04-24 22:07 UTC -------
Turns out that while it makes the sample_mpeg4.mp4 movie play correctly, my
patch doesn't fix the case in which GST_ROUND_UP_4(xvimage->width) and
GST_ROUND_UP_8(xvimage->width) return different values.

I'm probably misunderstanding something in gstreamer, but there seems to be a
fundamental problem in this case:

Suppose we have a 426x240 image in I420 (a real example - I ran into this with
Totem's visualizer plugin on a system w/ a 576px tall screen).

XvShmCreateImage takes width, height, and format as input. If the X driver
always returns an image that's exactly the requested size, xvimage->data_size
will be 426px * 240px * 1.5bytes/px = 153360bytes.

However, gstreamer expects a shared image with size = 154560
(gst_xvimagesink_show_frame gets handed a GstBuffer with size = 154560, and the
'sanity check' code in gst_xvimagesink_xvimage_new also expects an image w/
size 154560).

Therefore XvShmCreateImage needs to return an image where xvimage->data_size =
154560 in order to appease the sanity checks in gst_xvimagesink_xvimage_new, 
gst_xvimagesink_show_frame, and gst-xvimagesink_buffer_alloc.

If XvShmCreateImage does exactly what's requested, though, it's not possible to
create the proper surface:
154560 / 1.5 / 240 = 429.333....

The calculation for 154560 is as follows:
GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) + GST_ROUND_UP_2 (height) *
GST_ROUND_UP_8 (width) /2 = size

428 * 240 + 240 * 432 / 2 = 154560

See http://bugzilla.gnome.org/page.cgi?id=email.html for more info about why you received
this email, why you can't respond via email, how to stop receiving
emails (or reduce the number you receive), and how to contact someone
if you are having problems with the system.

You can add comments to this bug at http://bugzilla.gnome.org/show_bug.cgi?id=577346.

More information about the Gstreamer-bugs mailing list