summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-11-13 22:36:00 +0100
committerDudemanguy <random342@airmail.cc>2023-11-18 22:54:29 +0000
commitc8a2f8eb7f5117e4148e8d1b473b19ded574244f (patch)
tree10b651c250ca6634e7e112292608b46988ce3784 /video
parentdc2d58b51404fe7584b07af67f9b4797759e944e (diff)
downloadmpv-c8a2f8eb7f5117e4148e8d1b473b19ded574244f.tar.bz2
mpv-c8a2f8eb7f5117e4148e8d1b473b19ded574244f.tar.xz
vo_gpu_next: make the first frame check less ominous
It is valid to disable interpolation on resets and when the vsync error exceeds the duration of the frames that we have available.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_gpu_next.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c
index 02af20fa43..3d976c6301 100644
--- a/video/out/vo_gpu_next.c
+++ b/video/out/vo_gpu_next.c
@@ -970,15 +970,18 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
#endif
);
- // mpv likes to generate sporadically jumping PTS shortly after
- // initialization, but pl_queue does not like these. Hard-clamp to
- // the first frame in the queue as a simple workaround.
+ // Depending on the vsync ratio, we may be up to half of the vsync
+ // duration before the current frame time. This works fine because
+ // pl_queue will have this frame, unless it's after a reset event. In
+ // this case, start from the first available frame.
struct pl_source_frame first;
- if (pl_queue_peek(p->queue, 0, &first)) {
- if (qparams.pts < first.pts)
- MP_VERBOSE(vo, "Clamping first frame PTS from %f to %f\n", qparams.pts, first.pts);
- qparams.pts = p->last_pts = MPMAX(qparams.pts, first.pts);
+ if (pl_queue_peek(p->queue, 0, &first) && qparams.pts < first.pts) {
+ if (first.pts != frame->current->pts)
+ MP_VERBOSE(vo, "Current PTS(%f) != VPTS(%f)\n", frame->current->pts, first.pts);
+ MP_VERBOSE(vo, "Clamping first frame PTS from %f to %f\n", qparams.pts, first.pts);
+ qparams.pts = first.pts;
}
+ p->last_pts = qparams.pts;
switch (pl_queue_update(p->queue, &mix, &qparams)) {
case PL_QUEUE_ERR: