1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 01:22:30 +00:00

sd_lavc: account for floating point inaccuracy

Timestamps are converted from microsecond resolution timestamp, we don't
have more precision, so we have to account for that when comparing the
floating point values as them will slightly be off.

Fixes: #12327
This commit is contained in:
Kacper Michajłow 2023-09-08 01:41:49 +02:00 committed by Dudemanguy
parent 09da37356d
commit 9c9ec073bd

View File

@ -398,7 +398,7 @@ static struct sub *get_current(struct sd_lavc_priv *priv, double pts)
continue;
if (pts == MP_NOPTS_VALUE ||
((sub->pts == MP_NOPTS_VALUE || pts + 1e-6 >= sub->pts) &&
(sub->endpts == MP_NOPTS_VALUE || pts < sub->endpts)))
(sub->endpts == MP_NOPTS_VALUE || pts + 1e-6 < sub->endpts)))
{
// Ignore "trailing" subtitles with unknown length after 1 minute.
if (sub->endpts == MP_NOPTS_VALUE && pts >= sub->pts + 60)