mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-22 10:57:08 +00:00
vo: trigger manual redraws at most at slightly over display fps
This is workaround for some windowing platforms that break when they get too many present requests. Fixes: #17082
This commit is contained in:
@@ -1182,8 +1182,17 @@ static MP_THREAD_VOID vo_thread(void *ptr)
|
||||
if (send_pause)
|
||||
vo->driver->control(vo, vo_paused ? VOCTRL_PAUSE : VOCTRL_RESUME, NULL);
|
||||
if (wait_until > now && redraw) {
|
||||
vo->driver->control(vo, VOCTRL_REDRAW, NULL);
|
||||
do_redraw(vo); // now is a good time
|
||||
// Allow manual redraws at most at slightly over display fps.
|
||||
int64_t max_interval = (MP_TIME_S_TO_NS(1) / MPMAX(in->display_fps, 10)) / 1.1;
|
||||
// Some windowing platforms break if we submit frames too fast.
|
||||
if (vo->previous_redraw_time + max_interval <= now) {
|
||||
vo->driver->control(vo, VOCTRL_REDRAW, NULL);
|
||||
do_redraw(vo); // now is a good time
|
||||
vo->previous_redraw_time = now;
|
||||
} else {
|
||||
in->request_redraw = true;
|
||||
wait_vo(vo, now + max_interval);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (vo->want_redraw) // might have been set by VOCTRLs
|
||||
|
||||
@@ -508,6 +508,7 @@ struct vo {
|
||||
struct mp_vo_opts *opts;
|
||||
|
||||
bool want_redraw; // redraw as soon as possible
|
||||
int64_t previous_redraw_time;
|
||||
|
||||
// current window state
|
||||
int dwidth;
|
||||
|
||||
Reference in New Issue
Block a user