From 486516f723d3159c82c75b15a2eefed366542b77 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Sun, 16 Aug 2020 16:29:00 -0500 Subject: wayland: don't rely on presentation discarded When using presentation time, we have to be sure to update the ust when no presentation events are received to make sure playback is still smooth and in sync. Part of the recent presentation time refactor was to use the presentation discarded event to signal that the window is hidden. Evidently, this doesn't work the same everywhere for whatever reason (drivers?? hardware??) and at least one user experienced issues with playback getting out of sync since (presumably) the discarded event didn't occur when hiding the window. Instead, let's just go back to the old way of checking if the last_ust is equal to the ust value of the last member in the wayland sync queue. Fixes #8010. --- video/out/wayland_common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'video/out/wayland_common.c') diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 993c7b0e54..99aa8ee018 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -1607,9 +1607,10 @@ void wayland_sync_swap(struct vo_wayland_state *wl) wl->last_skipped_vsyncs = 0; - // If the presentation event was discarded, update the values based on - // the difference in mp_time. - if (wl->presentation_discarded) { + // If these are the same, presentation feedback has not been received. + // This will happen if the window is obscured/hidden in some way. Update + // the values based on the difference in mp_time. + if (wl->sync[index].ust == wl->last_ust && wl->last_ust) { wl->sync[index].ust += mp_time - wl->sync[index].last_mp_time; wl->sync[index].msc += 1; wl->sync[index].sbc += 1; -- cgit v1.2.3