summaryrefslogtreecommitdiffstats
path: root/sub/dec_sub.c
diff options
context:
space:
mode:
Diffstat (limited to 'sub/dec_sub.c')
-rw-r--r--sub/dec_sub.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index b6672348a5..3b1e957038 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -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;