mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 00:02:13 +00:00
subtitles: Fix recent filter-rendered libass timing problem
commit 4c552b2e42
("core: Do
OSD/subtitle updates at a more accurate point") made filter-rendered
libass subtitles appear one frame too late the first time they became
visible (VO rendering was not affected, and filter rendering was
accurate if seeking back later). The reason was that the subtitle code
did not feed the subtitle events to libass before their starting time,
and this now happened after the filtering phase. Fix this by skipping
the time check in the libass case and feeding demuxed subtitles to
it unconditionally (as timing is done separately anyway with libass).
There are still at least theoretically possible new problems in the
filter-rendered case because the filter now relies on packets demuxed
before the _previous_ frame. There's a bigger chance of getting the
subtitle packet too late, and the filter can't see packets for the
first frame after a seek. However the former is not an issue for the
samples I tested even with -nosound, and subtitles are not in general
guaranteed to be shown when seeking to a new position (though it could
be worth a later improvement).
This commit is contained in:
parent
9afcdab694
commit
55f94a1a91
10
mpcommon.c
10
mpcommon.c
@ -157,8 +157,14 @@ void update_subtitles(struct MPContext *mpctx, struct MPOpts *opts,
|
||||
ds_get_next_pts(d_dvdsub);
|
||||
while (d_dvdsub->first) {
|
||||
double subpts = ds_get_next_pts(d_dvdsub) + sub_offset;
|
||||
if (subpts > curpts)
|
||||
break;
|
||||
if (subpts > curpts) {
|
||||
// Libass handled subs can be fed to it in advance
|
||||
if (!opts->ass_enabled || type == 'd')
|
||||
break;
|
||||
// Try to avoid demuxing whole file at once
|
||||
if (d_dvdsub->non_interleaved && subpts > curpts + 1)
|
||||
break;
|
||||
}
|
||||
endpts = d_dvdsub->first->endpts + sub_offset;
|
||||
len = ds_get_packet_sub(d_dvdsub, &packet);
|
||||
if (type == 'm') {
|
||||
|
Loading…
Reference in New Issue
Block a user