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.
This commit is contained in:
Dudemanguy 2023-12-12 09:18:14 -06:00 committed by sfan5
parent 8f22916f85
commit 9e27b1f523
1 changed files with 2 additions and 1 deletions

View File

@ -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)