From 0bf4da0f5e70bd612644107f1634d2d4763ae4fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sun, 4 Feb 2024 16:33:55 +0100 Subject: [PATCH] Revert "vo: remove frame timing check from vo_still_displaying()" This reverts commit ef11d31c3acfd71307a94e44ad164a4861287675. --- video/out/vo.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/video/out/vo.c b/video/out/vo.c index aa98bc8aea..31d96c600f 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -1202,9 +1202,16 @@ void vo_seek_reset(struct vo *vo) bool vo_still_displaying(struct vo *vo) { struct vo_internal *in = vo->in; - mp_mutex_lock(&in->lock); - bool working = in->rendering || in->frame_queued; - mp_mutex_unlock(&in->lock); + mp_mutex_lock(&vo->in->lock); + int64_t now = mp_time_ns(); + int64_t frame_end = 0; + if (in->current_frame) { + frame_end = in->current_frame->pts + MPMAX(in->current_frame->duration, 0); + if (in->current_frame->display_synced) + frame_end = in->current_frame->num_vsyncs > 0 ? INT64_MAX : 0; + } + bool working = now < frame_end || in->rendering || in->frame_queued; + mp_mutex_unlock(&vo->in->lock); return working && in->hasframe; }