From 27a78276eb4b68f230e441e1baedf26f3cd66fbd Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Tue, 19 Sep 2023 13:11:30 -0500 Subject: [PATCH] vo: avoid unnecessary redraws when the OSD shows 296d40dc6f38401085d005bb4627f8afff46b041 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. --- video/out/vo.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/video/out/vo.c b/video/out/vo.c index faa172f2fd..7f57df2fe1 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -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; }