1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-28 18:12:22 +00:00
mpv/video/out
dudemanguy c68251a3a7 wayland: adjust hidden state detection
The wayland backend needs to keep track of whether or not a window is
hidden for presentation time. There is no presentation feedback when a
window is hidden which means we shouldn't be sending information to the
vo_sync_info structure (i.e. just leave it all at -1). This seemed to
work fine, but recent changes to presentation time in one notable
compositor (Sway; it was probably always broken in Weston actually)
changed the presentation time behavior.

For reasons that aren't clear, there is a greater than 16.666ms delay
between the first presentation time event and the second presentation
time event (compositor latency?) when you switch back to an mpv window
after it is hidden for long enough (a few seconds). When using
presentation time, this causes mpv to feed in some bad values in its
vsync timing mechanism thus causing the A/V desync spike as described in
issue #7223.

This solution is not really ideal. It would be better if the
presentation time events received by the compositors did not have the
aforementioned inconsistency. However since this occurs in both Sway and
Weston and clients can't really fight compositors in wayland-world,
here's a reasonable enough workaround. Basically, just add a slight
delay before we start feeding information into the vo_sync_info again.
We already do this when the window is hidden, so it's not a huge leap.

The delay chosen here is arbitrary, and it basically just recycles the
same parameters used to detect if a window is hidden. If
vo_wayland_wait_frame times out 60 times in a row (or whatever your
monitor's refresh rate is), then we assume the window is hidden. This is
a pretty safe assumption; something has to be terribly wrong for you to
miss 60 vblanks in a row while a window is on the screen.

In this case, we basically just do the reverse of that. If mpv receives
60 frame callbacks in a row (or whatever your monitor's refresh rate
is), then it assumes the window is not hidden. Previously, as soon as it
received 1 frame callback it was declared not hidden. Essentially,
there's just 1 second of delay after reshowing a window before the
presentation time statistics are used again. This should be more than
enough time to skip over the weird inconsistent behavior presentation
time behavior and avoid the A/V desync spike.

Fixes #7223
2019-12-10 17:55:43 +00:00
..
cocoa
cocoa-cb cocoa-cb: remove get_property_* usages and split up mpv helper 2019-10-06 13:29:48 +02:00
d3d11 vo_gpu/d3d11: add support for configuring swap chain color space 2019-10-30 02:41:25 +02:00
gpu vf_gpu: render subtitles 2019-11-30 18:09:31 +01:00
hwdec vo_gpu: hwdec_vaapi_gl: use gl_check_extension() instead of strstr() 2019-12-07 14:16:30 +01:00
opengl drm: avoid division by 0 in drm_pflip_cb with bad drivers 2019-12-07 18:34:25 +01:00
placebo video/out/gpu: Add a storable flag to ra_format 2019-07-08 00:59:28 +02:00
vulkan wayland: fix presentation time 2019-10-20 19:50:10 +00:00
win32
android_common.c context_android: move common code to a separate file 2019-09-27 00:05:06 +03:00
android_common.h context_android: move common code to a separate file 2019-09-27 00:05:06 +03:00
aspect.c aspect: add video margin options 2019-09-19 20:37:05 +02:00
aspect.h
bitmap_packer.c video/out/bitmap_packer: Avoid empty initializer list 2019-11-18 16:50:21 +01:00
bitmap_packer.h
cocoa_cb_common.swift cocoa-cb: remove get_property_* usages and split up mpv helper 2019-10-06 13:29:48 +02:00
cocoa_common.h
cocoa_common.m
d3d_shader_420p.h
d3d_shader_yuv.hlsl
dither.c
dither.h
dr_helper.c client API: fix potential deadlock problems by throwing more shit at it 2019-09-26 14:14:49 +02:00
dr_helper.h client API: fix potential deadlock problems by throwing more shit at it 2019-09-26 14:14:49 +02:00
drm_atomic.c
drm_atomic.h
drm_common.c drm: avoid division by 0 in drm_pflip_cb with bad drivers 2019-12-07 18:34:25 +01:00
drm_common.h drm: avoid division by 0 in drm_pflip_cb with bad drivers 2019-12-07 18:34:25 +01:00
drm_prime.c
drm_prime.h
filter_kernels.c
filter_kernels.h
libmpv.h
vo_caca.c vo_caca: Implement VOCTRL_UPDATE_WINDOW_TITLE 2019-10-29 17:07:41 +01:00
vo_direct3d.c
vo_drm.c vo_drm: replace drmModeAddFB usage with drmModeAddFB2 2019-12-07 19:23:58 +01:00
vo_gpu.c Revert "vo: add support for externally driven renderloop and make wayland use it" 2019-10-10 17:41:19 +00:00
vo_image.c screenshot, vo_image: use global swscale/zimg parameters 2019-10-31 15:44:09 +01:00
vo_lavc.c
vo_libmpv.c client API: fix potential deadlock problems by throwing more shit at it 2019-09-26 14:14:49 +02:00
vo_mediacodec_embed.c
vo_null.c
vo_rpi.c
vo_sdl.c vo_sdl: Acknowledge when the mouse enters or leaves the window 2019-10-28 17:14:49 +01:00
vo_tct.c video/out/vo_tct: Use octal escape sequence instead of non-standard \e 2019-11-18 16:50:21 +01:00
vo_vaapi.c vo: add warning message to vo_vaapi and vo_vdpau 2019-09-14 13:50:10 +02:00
vo_vdpau.c Replace uses of FFMIN/MAX with MPMIN/MAX 2019-10-31 11:24:20 +01:00
vo_wlshm.c sws_utils: shuffle around some shit 2019-10-31 15:26:03 +01:00
vo_x11.c vo_x11: accept zimg formats 2019-11-03 22:52:12 +01:00
vo_xv.c
vo.c vo: redraw dropped frame if paused between queuing and drawing frame 2019-12-04 23:55:42 +01:00
vo.h wayland: update Maximize and Minimize handling to use new options 2019-12-01 09:39:51 +08:00
w32_common.c w32_common: avoid unnecessary sprintfs 2019-05-10 20:47:05 +10:00
w32_common.h
wayland_common.c wayland: adjust hidden state detection 2019-12-10 17:55:43 +00:00
wayland_common.h wayland: fix cursor behavior on an edge case 2019-12-04 00:47:05 +00:00
win_state.c win_state: silence a valgrind warning 2019-09-19 20:37:05 +02:00
win_state.h
x11_common.c x11: implement unminimization 2019-11-29 14:27:27 +01:00
x11_common.h x11: use new option stuff to implement fullscreen 2019-11-29 13:56:58 +01:00