summaryrefslogtreecommitdiffstats
path: root/sub/sd_lavc.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-08-09 18:50:19 -0500
committerDudemanguy <random342@airmail.cc>2023-08-11 22:28:50 +0000
commit02a80f850b5403da89fefed7b32b3f3dfb82f647 (patch)
tree4f85b3dfba6536970393aa3d02b98b3fbb3fa4eb /sub/sd_lavc.c
parenta323dfae426e43451f4d3e08a9a63cb7d1c1ace9 (diff)
downloadmpv-02a80f850b5403da89fefed7b32b3f3dfb82f647.tar.bz2
mpv-02a80f850b5403da89fefed7b32b3f3dfb82f647.tar.xz
sub/sd_lavc: don't check endpts when getting subs
When getting subtitles, sd_lavc checks if the current pts plus a small offset (1e-6) is greater than the sub->pts as well as checking if the pts is less than the sub->endpts. The problem with the endpts check is that there are subtitles out there (pgs ones) that have overlapping durations and thus you'll get a case where pts is greater than endpts because a new subtitle shows up. However, the old subtitle is still meant to be on the screen. This results in a flickering effect where the subtitle flashes and then appears the next frame. The easy enough fix is to just loosen the condition and remove the endpts check altogether. That ensures that the subtitle remains selected for the entire duration. Unsure if this possibly could regress some other kind of subtitle out that that uses sd_lavc, but this does appear to fix a real issue with pgs subtitles. Fixes #8202 and #10051.
Diffstat (limited to 'sub/sd_lavc.c')
-rw-r--r--sub/sd_lavc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index 50d3f2bceb..ce20ddba2c 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -398,8 +398,7 @@ 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 + 1e-6 >= sub->pts))
{
// Ignore "trailing" subtitles with unknown length after 1 minute.
if (sub->endpts == MP_NOPTS_VALUE && pts >= sub->pts + 60)