Skip to content

Commit b23e8b2

Browse files
DanOscarssonDudemanguy
authored andcommitted
vo_vdpau: fix timing for nanoseconds
df764bc and c82c55b 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.
1 parent 4ab521f commit b23e8b2

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

video/out/vo_vdpau.c

+6-8
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ struct vdpctx {
8080

8181
struct mp_image *current_image;
8282
int64_t current_pts;
83-
int current_duration;
83+
int64_t current_duration;
8484

8585
int output_surface_w, output_surface_h;
8686
int rotation;
@@ -754,8 +754,8 @@ static void flip_page(struct vo *vo)
754754
struct vdp_functions *vdp = vc->vdp;
755755
VdpStatus vdp_st;
756756

757-
int64_t pts_us = vc->current_pts;
758-
int duration = vc->current_duration;
757+
int64_t pts_ns = vc->current_pts;
758+
int64_t duration = vc->current_duration;
759759

760760
vc->dropped_frame = true; // changed at end if false
761761

@@ -770,10 +770,8 @@ static void flip_page(struct vo *vo)
770770
}
771771
vc->vsync_interval = MPMAX(vc->vsync_interval, 1);
772772

773-
if (duration > INT_MAX / 1000)
773+
if (duration > INT_MAX)
774774
duration = -1;
775-
else
776-
duration *= 1000;
777775

778776
if (vc->vsync_interval == 1)
779777
duration = -1; // Make sure drop logic is disabled
@@ -782,8 +780,8 @@ static void flip_page(struct vo *vo)
782780
vdp_st = vdp->presentation_queue_get_time(vc->flip_queue, &vdp_time);
783781
CHECK_VDP_WARNING(vo, "Error when calling vdp_presentation_queue_get_time");
784782

785-
int64_t rel_pts_ns = (pts_us * 1000) - mp_time_ns();
786-
if (!pts_us || rel_pts_ns < 0)
783+
int64_t rel_pts_ns = pts_ns - mp_time_ns();
784+
if (!pts_ns || rel_pts_ns < 0)
787785
rel_pts_ns = 0;
788786

789787
uint64_t now = vdp_time;

0 commit comments

Comments
 (0)