GNOME Bugzilla – Bug 777400
dvdspu: fix crash when display_rect.bottom isn't even
Last modified: 2017-01-19 10:40:44 UTC
I have a set of sample files whose DVD subtitles are a bit odd. The ffmpeg render just positions them poorly, but GStreamer apps abort() because of a failed assertion in gstspu-vobsub-render.c. Just to see what would happen, I removed the assertion and it appears to work fine. I haven't the slightest idea why this assertion is there in the first place, so someone who does might have to make sure this patch isn't a regression ;)
Created attachment 343662 [details] [review] 0001-dvdspu-fix-crash-when-rendering-subs-w-odd-coords.patch
It probably should be an assert, because those are bad - but there's something odd there. We're supposed to start rendering subs on an even Y coordinate, then render pairs of lines so we can blend the half-sampled chroma easily. At the end is this clause, which may render 1 final line - but that line should always be on an even line, because we started on an even line and rendered in pairs. The implication is that the top coordinate of these DVD subs is starting on an odd line and we should look at it more closely (also not valid by the DVD spec IIRC). Can you please provide a GST_DEBUG=gstspu:6 debug log?
Created attachment 343679 [details] GST_DEBUG=gstspu:6 Here you go!
Thanks! As suspected, it starts on an odd line: 197:gst_dvd_spu_exec_cmd_blk:<renderer> Set Display Area top 647 left 0 bottom 695 right 1279
Created attachment 343680 [details] [review] dvdspu: Handle vob display rect starting on an odd line DVDs always have subpictures that start on an even Y coordinate, but gstspu does more generic vobsubs these days, so handle ones that start on an odd vertical position.
Please let me know if this patch fixes it and renders ok - or - if you can - please provide a sample.
Yep, seems to work fine. Thanks!
Created attachment 343681 [details] [review] dvdspu: Handle vob display rect starting on an odd line DVDs always have subpictures that start on an even Y coordinate, but gstspu does more generic vobsubs these days, so handle ones that start on an odd vertical position.
Thanks for testing. I realised I made one small typo in the first patch though - sorry!
That one works too, but every other scan line is omitted. Lemme get a screenshot for you
Created attachment 343682 [details] Screenshot of missing scan lines
Created attachment 343683 [details] Problematic vobsub sample These are the subtitles I've been using as a test case. The second set of dialogue to appear on screen is both what triggered the assert and was rendered strangely. Extracted with `ffmpeg -i <input>.mkv -an -vn -c:s copy -f rawvideo out`
That test sample isn't recognisable, sorry. I can reproduce with a standard file and a small hack to skip the first line of rendering though.
Created attachment 343685 [details] [review] dvdspu: Handle vob display rect starting on an odd line DVDs always have subpictures that start on an even Y coordinate, but gstspu does more generic vobsubs these days, so handle ones that start on an odd vertical position.
This patch should fix the rendering.
Works great over here
Thanks! Pushed: commit 17430e7b82352f1dc8caedddbf47d6c579c8235e Author: Jan Schmidt <jan@centricular.com> Date: Wed Jan 18 11:05:21 2017 +1100 dvdspu: Handle vob display rect starting on an odd line DVDs always have subpictures that start on an even Y coordinate, but gstspu does more generic vobsubs these days, so handle ones that start on an odd vertical position. https://bugzilla.gnome.org/show_bug.cgi?id=777400
Should this go into 1.10?
(In reply to Sebastian Dröge (slomo) from comment #18) > Should this go into 1.10? Yes