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.
This commit is contained in:
wm4 2014-09-20 14:54:19 +02:00
parent 5e6c9963d8
commit 461c78e4d9
1 changed files with 9 additions and 10 deletions

View File

@ -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);