mirror of
https://github.com/mpv-player/mpv
synced 2024-11-14 22:48:35 +01:00
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.
This commit is contained in:
parent
a323dfae42
commit
02a80f850b
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user