vo_vdpau: fix timing for nanoseconds

df764bc0c3 and
c82c55b4b9 blindly converted the units for
this VO since neither of us actually have the hardware/setup to test the
VO. Well it was not actually correct (maybe just one was wrong or both
who knows) since vo_vdpau using timing very differently than all the
other VOs and no one reported on it until just now. Anyways, just apply
this random patch from @DanOscarsson which apparently works for him and
call it a day. Fixes #13397.
This commit is contained in:
Dan Oscarsson 2024-02-04 09:47:04 -06:00 committed by Dudemanguy
parent 4ab521f080
commit b23e8b2ffb
1 changed files with 6 additions and 8 deletions

View File

@ -80,7 +80,7 @@ struct vdpctx {
struct mp_image *current_image;
int64_t current_pts;
int current_duration;
int64_t current_duration;
int output_surface_w, output_surface_h;
int rotation;
@ -754,8 +754,8 @@ static void flip_page(struct vo *vo)
struct vdp_functions *vdp = vc->vdp;
VdpStatus vdp_st;
int64_t pts_us = vc->current_pts;
int duration = vc->current_duration;
int64_t pts_ns = vc->current_pts;
int64_t duration = vc->current_duration;
vc->dropped_frame = true; // changed at end if false
@ -770,10 +770,8 @@ static void flip_page(struct vo *vo)
}
vc->vsync_interval = MPMAX(vc->vsync_interval, 1);
if (duration > INT_MAX / 1000)
if (duration > INT_MAX)
duration = -1;
else
duration *= 1000;
if (vc->vsync_interval == 1)
duration = -1; // Make sure drop logic is disabled
@ -782,8 +780,8 @@ static void flip_page(struct vo *vo)
vdp_st = vdp->presentation_queue_get_time(vc->flip_queue, &vdp_time);
CHECK_VDP_WARNING(vo, "Error when calling vdp_presentation_queue_get_time");
int64_t rel_pts_ns = (pts_us * 1000) - mp_time_ns();
if (!pts_us || rel_pts_ns < 0)
int64_t rel_pts_ns = pts_ns - mp_time_ns();
if (!pts_ns || rel_pts_ns < 0)
rel_pts_ns = 0;
uint64_t now = vdp_time;