summaryrefslogtreecommitdiffstats
path: root/sub/sd_lavc.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-08-18 19:56:40 -0500
committerDudemanguy <random342@airmail.cc>2023-08-19 15:18:12 +0000
commit725b631ec3bdd5016072b5a6aa6a218fb87ffd11 (patch)
tree9369eb39c3c5d2a61ec604b9787241d277e8c57c /sub/sd_lavc.c
parent72e417850394a08fab467f55d4e6ae4a9fbcd23a (diff)
downloadmpv-725b631ec3bdd5016072b5a6aa6a218fb87ffd11.tar.bz2
mpv-725b631ec3bdd5016072b5a6aa6a218fb87ffd11.tar.xz
sd_lavc: use SUB_GAP_THRESHOLD for overlaps/gaps
It turns out this already exists for sd_ass and is being used there. We can make use of this arbitrary threshold instead for overlapping subtitle durations to avoid the weird flashing behavior with some pgs subtitles.
Diffstat (limited to 'sub/sd_lavc.c')
-rw-r--r--sub/sd_lavc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index adca4199b1..eb71bdd0c2 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -398,8 +398,8 @@ static struct sub *get_current(struct sd_lavc_priv *priv, double pts)
if (!sub->valid)
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->pts == MP_NOPTS_VALUE || pts + SUB_GAP_THRESHOLD >= sub->pts) &&
+ (sub->endpts == MP_NOPTS_VALUE || pts - SUB_GAP_THRESHOLD <= sub->endpts)))
{
// Ignore "trailing" subtitles with unknown length after 1 minute.
if (sub->endpts == MP_NOPTS_VALUE && pts >= sub->pts + 60)