sub/sd_ass: subtitle timing rounding error#18039
Conversation
|
@arch1t3cht: Could you do the same in aegi? |
|
Please squash the commits. I also think that a test for single math operation is a bit overkill. |
|
Of course. I'm removing the test file before squashing then |
7f8462a to
ea85a60
Compare
Use floor(pts * 1000 + 1e-6) to avoid floating-point precision errors causing early subtitle presentation on boundary frames. Fixes: mpv-player#17453 Signed-off-by: Ricardo Fonseca <ricardofonseca94321@tecnico.ulisboa.pt>
Yeah, I will. A hardcoded |
|
Why not just use |
Having bigger epsilon is safer. If the |
Sure. Are you also referring to |
Yes, and 2 more. Search for |
Use nearbyint() when the value is extremely close to an integer and floor() otherwise to prevent forward rounding caused by floating-point precision errors. This avoids early subtitle presentation on boundary frames.
Add test for ASS subtitle timing to ensure correct rendering around boundary timestamps.
Fixes: #17453
Read this before you submit this pull request:
https://github.com/mpv-player/mpv/blob/master/DOCS/contribute.md
Reading this link and following the rules will get your pull request reviewed
and merged faster. Nobody wants lazy pull requests.