summaryrefslogtreecommitdiffstats
path: root/player/sub.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-12-12 09:18:14 -0600
committersfan5 <sfan5@live.de>2023-12-12 18:54:46 +0100
commit9e27b1f523071db184443d78f7144cb599dd0829 (patch)
tree9f7e64c583db6c3dea2047d4526206a132a6ce4d /player/sub.c
parent8f22916f85b5957e6999cc766d1d72aa73052ecc (diff)
downloadmpv-9e27b1f523071db184443d78f7144cb599dd0829.tar.bz2
mpv-9e27b1f523071db184443d78f7144cb599dd0829.tar.xz
sub: don't busy loop if the player is paused for cache
When updating subtitles while paused, mpv waits until a packet is available. However in the case of a network stream, it is possible that mpv will pause itself when buffering for cache reasons. This makes that particular loop do a busy loop and can take a long time depending on network streams. Simply just don't do the loop here if we are paused for cache reasons. Fixes #13077.
Diffstat (limited to 'player/sub.c')
-rw-r--r--player/sub.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/player/sub.c b/player/sub.c
index f3e42fe13b..a498558173 100644
--- a/player/sub.c
+++ b/player/sub.c
@@ -204,7 +204,8 @@ void reinit_sub(struct MPContext *mpctx, struct track *track)
// When paused we have to wait for packets to be available.
// So just retry until we get a packet in this case.
if (mpctx->playback_initialized)
- while (!update_subtitles(mpctx, mpctx->playback_pts) && mpctx->paused);
+ while (!update_subtitles(mpctx, mpctx->playback_pts) &&
+ mpctx->paused && !mpctx->paused_for_cache);
}
void reinit_sub_all(struct MPContext *mpctx)