From 9e27b1f523071db184443d78f7144cb599dd0829 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Tue, 12 Dec 2023 09:18:14 -0600 Subject: [PATCH] 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. --- player/sub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)