mirror of
https://github.com/mpv-player/mpv
synced 2024-12-21 22:30:22 +00:00
sub: force segment switch if video is already ahead
In particular, this prevents subtitle packets from building up in the subtitle queue if e.g. --vo=null is used. In this situation, sub_get_bitmaps() is never called, and thus the segment never switched. This also seems to help with flickering at segment switch boundaries (if subs are supposed to be visible at the transition points). In theory, this could trigger a switch too early, but the way VO and subtitle renderer interact wrt. timing is a bit iffy anyway.
This commit is contained in:
parent
dafafc90de
commit
5fe2812494
@ -150,6 +150,9 @@ static void update_segment(struct dec_sub *sub)
|
||||
if (sub->new_segment && sub->last_vo_pts != MP_NOPTS_VALUE &&
|
||||
sub->last_vo_pts >= sub->new_segment->start)
|
||||
{
|
||||
MP_VERBOSE(sub, "Switch segment: %f at %f\n", sub->new_segment->start,
|
||||
sub->last_vo_pts);
|
||||
|
||||
sub->codec = sub->new_segment->codec;
|
||||
sub->start = sub->new_segment->start;
|
||||
sub->end = sub->new_segment->end;
|
||||
@ -210,6 +213,11 @@ bool sub_read_packets(struct dec_sub *sub, double video_pts)
|
||||
if (!read_more)
|
||||
break;
|
||||
|
||||
if (sub->new_segment && sub->new_segment->start < video_pts) {
|
||||
sub->last_vo_pts = video_pts;
|
||||
update_segment(sub);
|
||||
}
|
||||
|
||||
if (sub->new_segment)
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user