diff options
author | Dudemanguy <random342@airmail.cc> | 2023-08-09 16:39:58 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-08-11 22:28:50 +0000 |
commit | a323dfae426e43451f4d3e08a9a63cb7d1c1ace9 (patch) | |
tree | a306f33c69c47bc4589b11a3d5831ff05ef80def /sub/dec_sub.c | |
parent | 9ff2caff9875fa761b19edccd4ecdf84937d451f (diff) | |
download | mpv-a323dfae426e43451f4d3e08a9a63cb7d1c1ace9.tar.bz2 mpv-a323dfae426e43451f4d3e08a9a63cb7d1c1ace9.tar.xz |
sub: fix switching tracks while paused
Internal subtitles were not shown when switching between tracks while
mpv was paused. The reason for this is simply because the demuxer data
isn't available yet when the track switch happens. Fixing it is
basically just retrying until the packet is actually available when the
player is paused. Fixes #8311.
Diffstat (limited to 'sub/dec_sub.c')
-rw-r--r-- | sub/dec_sub.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c index 30f5b651b0..b31178ced7 100644 --- a/sub/dec_sub.c +++ b/sub/dec_sub.c @@ -273,7 +273,7 @@ static bool is_new_segment(struct dec_sub *sub, struct demux_packet *p) // Read packets from the demuxer stream passed to sub_create(). Return true if // enough packets were read, false if the player should wait until the demuxer // signals new packets available (and then should retry). -bool sub_read_packets(struct dec_sub *sub, double video_pts) +bool sub_read_packets(struct dec_sub *sub, double video_pts, bool force) { bool r = true; pthread_mutex_lock(&sub->lock); @@ -295,7 +295,7 @@ bool sub_read_packets(struct dec_sub *sub, double video_pts) break; // (Use this mechanism only if sub_delay matters to avoid corner cases.) - double min_pts = sub->opts->sub_delay < 0 ? video_pts : MP_NOPTS_VALUE; + double min_pts = sub->opts->sub_delay < 0 || force ? video_pts : MP_NOPTS_VALUE; struct demux_packet *pkt; int st = demux_read_packet_async_until(sub->sh, min_pts, &pkt); |