diff options
author | wm4 <wm4@nowhere> | 2014-08-17 02:50:59 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-08-17 02:50:59 +0200 |
commit | 5b64f5ad35ba00d894c9efb1b12fa93ed1aa27fa (patch) | |
tree | db520914a6aef094aef098d885ee0ff5d0a6a2c7 /video/out/vo_vdpau.c | |
parent | 4822056db7a9f717eace337aeda760c35ab114d5 (diff) | |
download | mpv-5b64f5ad35ba00d894c9efb1b12fa93ed1aa27fa.tar.bz2 mpv-5b64f5ad35ba00d894c9efb1b12fa93ed1aa27fa.tar.xz |
video: take refresh rate changes into account
This works only on X11, and only if the refresh rate changes due to the
window being moved to another screen (detected by us). It doesn't
include system screen reconfiguration yet.
This calls VOCTRL_GET_DISPLAY_FPS on every frame, which makes me uneasy.
It means extra thread communication with the win32 and Cocoa backends.
On the other hand, a frame doesn't happen _that_ often, and the
communication should still be pretty cheap and fast, so it's probably
ok.
Also needs some extra fuzz for vo_vdpau.c, because that does everything
differently.
Diffstat (limited to 'video/out/vo_vdpau.c')
-rw-r--r-- | video/out/vo_vdpau.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index 6699e1b906..005e733357 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -329,27 +329,11 @@ static int win_x11_init_vdpau_flip_queue(struct vo *vo) CHECK_VDP_WARNING(vo, "Error setting colorkey"); } - vc->vsync_interval = 1; if (vc->composite_detect && vo_x11_screen_is_composited(vo)) { MP_INFO(vo, "Compositing window manager detected. Assuming timing info " "is inaccurate.\n"); - } else if (vc->user_fps > 0) { - vc->vsync_interval = 1e9 / vc->user_fps; - MP_INFO(vo, "Assuming user-specified display refresh rate of %.3f Hz.\n", - vc->user_fps); - } else if (vc->user_fps == 0) { - double fps = vo_x11_vm_get_fps(vo); - if (fps < 1) - MP_WARN(vo, "Failed to get display FPS\n"); - else { - vc->vsync_interval = 1e9 / fps; - // This is verbose, but I'm not yet sure how common wrong values are - MP_INFO(vo, "Got display refresh rate %.3f Hz.\n", fps); - MP_INFO(vo, "If that value looks wrong give the " - "-vo vdpau:fps=X suboption manually.\n"); - } - } else - MP_VERBOSE(vo, "framedrop/timing logic disabled by user.\n"); + vc->user_fps = -1; + } return 0; } @@ -737,6 +721,13 @@ static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration) if (!check_preemption(vo)) return; + vc->vsync_interval = 1; + if (vc->user_fps > 0) { + vc->vsync_interval = 1e9 / vc->user_fps; + } else if (vc->user_fps == 0) { + vc->vsync_interval = vo_get_vsync_interval(vo) * 1000; + } + if (duration > INT_MAX / 1000) duration = -1; else |