GNOME Bugzilla – Bug 341542
some users have an assertion failed: (GST_VIDEO_SINK_WIDTH (xvimagesink) > 0) when playing a theora video
Last modified: 2006-05-26 09:55:34 UTC
Debug log: : tfheen@golem ~ > GST_DEBUG=xvimagesink:5 gst-launch-0.10 filesrc location=/home/tfheen/foo.ogg ! oggdemux ! theoradec ! ffmpegcolorspace ! xvimagesink Setting pipeline to PAUSED ... DEBUG (0x5098d0 - 0:00:00.192156000) xvimagesink( 3133) xvimagesink.c(1332):gst_xvimagesink_xcontext_get:<xvimagesink0> X reports 1280x1024 pixels and 542 mm x 406 mm DEBUG (0x5098d0 - 0:00:00.192320000) xvimagesink( 3133) xvimagesink.c(1260):gst_xvimagesink_calculate_pixel_aspect_ratio: calculated pixel aspect ratio: 1,067980 DEBUG (0x5098d0 - 0:00:00.192458000) xvimagesink( 3133) xvimagesink.c(1275):gst_xvimagesink_calculate_pixel_aspect_ratio: Decided on index 1 (16/15) DEBUG (0x5098d0 - 0:00:00.192556000) xvimagesink( 3133) xvimagesink.c(1283):gst_xvimagesink_calculate_pixel_aspect_ratio: set xcontext PAR to 16/15 DEBUG (0x5098d0 - 0:00:00.192777000) xvimagesink( 3133) xvimagesink.c(1077):gst_xvimagesink_get_xv_support: Found 1 XV adaptor(s) DEBUG (0x5098d0 - 0:00:00.192910000) xvimagesink( 3133) xvimagesink.c(1094):gst_xvimagesink_get_xv_support: XV Adaptor ATI Radeon Video Overlay with 1 ports DEBUG (0x5098d0 - 0:00:00.193326000) xvimagesink( 3133) xvimagesink.c(1201):gst_xvimagesink_get_xv_support: Generated the following caps: video/x-raw-rgb, endianness=(int)4321, depth=(int)24, bpp=(int)32, blue_mask=(int)16711680, green_mask=(int)65280, red_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, endianness=(int)4321, depth=(int)24, bpp=(int)32, blue_mask=(int)16711680, green_mask=(int)65280, red_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, endianness=(int)4321, depth=(int)24, bpp=(int)32, blue_mask=(int)31744, green_mask=(int)992, red_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, endianness=(int)4321, depth=(int)24, bpp=(int)32, blue_mask=(int)63488, green_mask=(int)2016, red_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)YUY2, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)YV12, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)I420, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ] DEBUG (0x5098d0 - 0:00:00.194227000) xvimagesink( 3133) xvimagesink.c(399):gst_xvimagesink_check_xshm_calls: XvShmCreateImage of 1x1 DEBUG (0x5098d0 - 0:00:00.194543000) xvimagesink( 3133) xvimagesink.c(1388):gst_xvimagesink_xcontext_get: xvimagesink is using XShm extension DEBUG (0x5098d0 - 0:00:00.195117000) xvimagesink( 3133) xvimagesink.c(1735):gst_xvimagesink_change_state:<xvimagesink0> set calculated PAR on object's PAR DEBUG (0x5098d0 - 0:00:00.195232000) xvimagesink( 3133) xvimagesink.c(1739):gst_xvimagesink_change_state:<xvimagesink0> XSynchronize called with FALSE Pipeline is PREROLLING ... DEBUG (0x73eee0 - 0:00:00.271032000) xvimagesink( 3133) xvimagesink.c(1597):gst_xvimagesink_setcaps:<xvimagesink0> In setcaps. Possible caps video/x-raw-rgb, endianness=(int)4321, depth=(int)24, bpp=(int)32, blue_mask=(int)16711680, green_mask=(int)65280, red_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, endianness=(int)4321, depth=(int)24, bpp=(int)32, blue_mask=(int)16711680, green_mask=(int)65280, red_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, endianness=(int)4321, depth=(int)24, bpp=(int)32, blue_mask=(int)31744, green_mask=(int)992, red_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, endianness=(int)4321, depth=(int)24, bpp=(int)32, blue_mask=(int)63488, green_mask=(int)2016, red_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)YUY2, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)YV12, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)I420, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], setting caps video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)533333/500000, width=(int)360, height=(int)288 DEBUG (0x73eee0 - 0:00:00.271997000) xvimagesink( 3133) xvimagesink.c(1601):gst_xvimagesink_setcaps:<xvimagesink0> intersection returned video/x-raw-yuv, format=(fourcc)I420, width=(int)360, height=(int)288, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)533333/500000 DEBUG (0x73eee0 - 0:00:00.272193000) xvimagesink( 3133) xvimagesink.c(1659):gst_xvimagesink_setcaps:<xvimagesink0> video width/height: 360x288, calculated display ratio: 176871137/248870912 DEBUG (0x73eee0 - 0:00:00.272315000) xvimagesink( 3133) xvimagesink.c(1676):gst_xvimagesink_setcaps:<xvimagesink0> approximating while keeping video height DEBUG (0x73eee0 - 0:00:00.272429000) xvimagesink( 3133) xvimagesink.c(1681):gst_xvimagesink_setcaps:<xvimagesink0> scaling to -2x288 ** ERROR **: file xvimagesink.c: line 1689 (gst_xvimagesink_setcaps): assertion failed: (GST_VIDEO_SINK_WIDTH (xvimagesink) > 0) aborting... zsh: abort GST_DEBUG=xvimagesink:5 gst-launch-0.10 filesrc location=/home/tfheen/foo.ogg : tfheen@golem ~ >
setting as blocked as asked by thaytan
interesting, I was actually wondering when we would have the first overflow :) Jan and I are working out fixes. First thing to note is that the encoder probably made a rounding error; it's stored as 533333/500000 which is amazingly close to 16/15. (Talking to myself) I'm currently thinking we should have a function that can take a series of fractions and reduce their multiplication, noting overflow. It should do its best to avoid overflows. It could do this by ordering numerators and denominators, or splitting up in prime factors and crossing them off just like in school. The function itself could take a valist of GstFraction, or a valist of num,den pairs, where either could be set to 1.
Here's a simple test case that reproduces the problem: gst-launch videotestsrc ! video/x-raw-yuv,pixel-aspect-ratio='(fraction)'533333/500000,width=360,height=288 ! xvimagesink pixel-aspect-ratio=16/15 Attaching a patch shortly.
Created attachment 65333 [details] [review] fix This fixes the bug in xvimagesink, as well as the same problem in videoscale
Fixed in CVS: * docs/libs/gst-plugins-base-libs-docs.sgml: * docs/libs/gst-plugins-base-libs-sections.txt: * gst-libs/gst/video/video.c: (gst_video_calculate_display_ratio): * gst-libs/gst/video/video.h: * gst/videoscale/Makefile.am: * gst/videoscale/gstvideoscale.c: (gst_video_scale_fixate_caps): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_setcaps): * tests/check/Makefile.am: * tests/check/libs/video.c: (GST_START_TEST), (video_suite), (main): Fix integer overflow problem with pixel-aspect-ratio calculations in videoscale and xvimagesink (#341542)
Apparently this isn't completely fixed for all users: gst-launch videotestsrc ! video/x-raw-yuv,width=360,height=288,pixel-aspect-ratio=533333/500000 ! xvimagesink pixel-aspect-ratio=54/59 still results in an overflow when choosing the scaled width and height. Attaching patch.
Created attachment 65830 [details] [review] additional fix This patch makes xvimagesink and videoscale use the gstutils scaling function for calculating the scaled width/height of the video, avoiding 32-bit overflow in the multiplication.
CVS fix works great, that you, I'll upload that to dapper
ok, closing.