summaryrefslogtreecommitdiffstats
path: root/sub/sd_lavc.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-09-08 01:41:49 +0200
committerDudemanguy <random342@airmail.cc>2023-09-09 02:48:23 +0000
commit9c9ec073bd4919239b04cbd9a4a9f86fa177dc65 (patch)
tree2b8a67abda71340a9a23230afb43d1bc56cbc149 /sub/sd_lavc.c
parent09da37356d529a2e37b4069aeebda3902991b6c8 (diff)
downloadmpv-9c9ec073bd4919239b04cbd9a4a9f86fa177dc65.tar.bz2
mpv-9c9ec073bd4919239b04cbd9a4a9f86fa177dc65.tar.xz
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
Diffstat (limited to 'sub/sd_lavc.c')
-rw-r--r--sub/sd_lavc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index e3a62da9f1..43dbfeee00 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -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)