diff options
author | wm4 <wm4@nowhere> | 2014-09-20 14:54:19 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-09-20 14:54:19 +0200 |
commit | 461c78e4d9d02c36f52a9846cea4160614ff42d0 (patch) | |
tree | d1bb80edf1a09ee2f33996f69fedafa9f5f8ba1b | |
parent | 5e6c9963d8873d0555f95be3fc7c9e4be161a2ff (diff) | |
download | mpv-461c78e4d9d02c36f52a9846cea4160614ff42d0.tar.bz2 mpv-461c78e4d9d02c36f52a9846cea4160614ff42d0.tar.xz |
vo_vdpau: fix confusion around vsync_interval
vc->vsync_interval and vsync_interval should be the same value, but
actually vc->vsync_interval was updated after vsync_interval was
initialized. This was probably not intended. Fix this by removing the
duplicate local variable. There were probably no bad effects.
-rw-r--r-- | video/out/vo_vdpau.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index 005e733357..f5f3121504 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -716,7 +716,6 @@ static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration) struct vdpctx *vc = vo->priv; struct vdp_functions *vdp = vc->vdp; VdpStatus vdp_st; - uint32_t vsync_interval = vc->vsync_interval; if (!check_preemption(vo)) return; @@ -774,7 +773,7 @@ static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration) * not make the target time in reality. Without this check we could drop * every frame, freezing the display completely if video lags behind. */ - if (now > PREV_VSYNC(FFMAX(pts, vc->last_queue_time + vsync_interval))) + if (now > PREV_VSYNC(FFMAX(pts, vc->last_queue_time + vc->vsync_interval))) npts = UINT64_MAX; /* Allow flipping a frame at a vsync if its presentation time is a @@ -793,28 +792,28 @@ static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration) * there would unnecessarily be a vsync without a frame change. */ uint64_t vsync = PREV_VSYNC(pts); - if (pts < vsync + vsync_interval / 4 + if (pts < vsync + vc->vsync_interval / 4 && (vsync - PREV_VSYNC(vc->last_queue_time) - > pts - vc->last_ideal_time + vsync_interval / 2 + > pts - vc->last_ideal_time + vc->vsync_interval / 2 || vc->dropped_frame && vsync > vc->dropped_time)) - pts -= vsync_interval / 2; + pts -= vc->vsync_interval / 2; vc->dropped_frame = true; // changed at end if false vc->dropped_time = ideal_pts; - pts = FFMAX(pts, vc->last_queue_time + vsync_interval); + pts = FFMAX(pts, vc->last_queue_time + vc->vsync_interval); pts = FFMAX(pts, now); - if (npts < PREV_VSYNC(pts) + vsync_interval) + if (npts < PREV_VSYNC(pts) + vc->vsync_interval) return; int num_flips = update_presentation_queue_status(vo); vsync = vc->recent_vsync_time + num_flips * vc->vsync_interval; pts = FFMAX(pts, now); - pts = FFMAX(pts, vsync + (vsync_interval >> 2)); + pts = FFMAX(pts, vsync + (vc->vsync_interval >> 2)); vsync = PREV_VSYNC(pts); - if (npts < vsync + vsync_interval) + if (npts < vsync + vc->vsync_interval) return; - pts = vsync + (vsync_interval >> 2); + pts = vsync + (vc->vsync_interval >> 2); VdpOutputSurface frame = vc->output_surfaces[vc->surface_num]; vdp_st = vdp->presentation_queue_display(vc->flip_queue, frame, vo->dwidth, vo->dheight, pts); |