Fix blend render returning empty result - #123
Conversation
273c54d to
3ba62d9
Compare
|
Thanks! Can you be more verbose in your description on why and how exactly a zero width image leads to runtime errors later?
Internally the positions (but not the extnents afaik) can be negative, but before the images are returned to the API-user libass clips them to the positive range. Negative values being returned would be a libass bug and this is also relied upon by mpv. So this is safe. On a side note, I find it a bit odd to always subtract 1 just to later readd 1. If it's to avoid signed-overflows, imho using |
|
👍
I think this is to get the exact right pixel: |
3ba62d9 to
003b77d
Compare
I think the commit message could still be a bit more explicit naming what API can't create zero-area images, e.g.: Otherwise this seems good to merge to me, thanks. |
libass may return empty images, but browsers do not allow creation of zero-area ImageData objects. Skipping and exiting early on empty images avoids this and as a bonus also saves a few CPU-cycles. Initially noticed on the 'Railgun S Karaoke Test' sample at ~26.38s (after the first verse) with `dropAllAnimations` from jellyfin enabled.
003b77d to
816e104
Compare
libass may return empty images, and 'blendResult' may become invalid (with zero height), leading to a runtime error when displaying.
Noticed on 'Railgun S Karaoke Test' ~26.38s (after the first verse) with
dropAllAnimationsenabled.Would checking
<= 0be better, sincewidthandheightareint?They probably can't be negative by design, but... 🤔
This seems to be reproduced with
wasm-blendon empty_image.ass.txt