0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

vo: avoid unnecessary redraws when the OSD shows

296d40dc6f changed how the vo handled
redraw requests in order to fix a race condition that can occur with
pausing. However, there was a slight oversight because a redraw request
that occurred while the core was unlocked and the video was still
playing would still be kept true (previously, this was always cleared).
That redraw is essential if mpv is paused otherwise the old issue comes
back, but if the video is playing it's unnecessary since the next loop
around will simply draw whatever we needed. The extra redraw could cause
a frame drop for some people in certain instances, so the solution is to
simply always clear redraw requests if !in->paused. This eliminates the
extra redraw but still keeps it when pausing.

Fixes #12426 and fixes #11579.
This commit is contained in:
Dudemanguy 2023-09-19 13:11:30 -05:00
parent 7a76cf4d65
commit 27a78276eb

View File

@ -1010,13 +1010,13 @@ static bool render_frame(struct vo *vo)
if (in->dropped_frame) {
MP_STATS(vo, "drop-vo");
} else {
// If the initial redraw request was true, then we can
// clear it here since we just performed a redraw and are
// merely clearing that request. However if there initially is
// If the initial redraw request was true or mpv is still playing,
// then we can clear it here since we just performed a redraw, or the
// next loop will draw what we need. However if there initially is
// no redraw request, then something can change this (i.e. the OSD)
// while the vo was unlocked. Don't touch in->request_redraw
// in that case.
if (request_redraw)
// while the vo was unlocked. If we are paused, don't touch
// in->request_redraw in that case.
if (request_redraw || !in->paused)
in->request_redraw = false;
}