summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/video.c3
-rw-r--r--video/out/opengl/video.c7
-rw-r--r--video/out/vo.c4
-rw-r--r--video/out/vo.h4
4 files changed, 8 insertions, 10 deletions
diff --git a/player/video.c b/player/video.c
index 561bb0b202..682ead6944 100644
--- a/player/video.c
+++ b/player/video.c
@@ -992,7 +992,6 @@ static void handle_display_sync_frame(struct MPContext *mpctx,
int num_vsyncs = MPMAX(lrint(ratio), 0);
double prev_error = mpctx->display_sync_error;
mpctx->display_sync_error += frame_duration - num_vsyncs * vsync;
- frame->vsync_offset = mpctx->display_sync_error * 1e6;
MP_DBG(mpctx, "s=%f vsyncs=%d dur=%f ratio=%f err=%.20f (%f/%f)\n",
mpctx->speed_factor_v, num_vsyncs, adjusted_duration, ratio,
@@ -1046,6 +1045,8 @@ static void handle_display_sync_frame(struct MPContext *mpctx,
// A bad guess, only needed when reverting to audio sync.
mpctx->time_frame = time_left;
+ frame->vsync_interval = vsync;
+ frame->vsync_offset = mpctx->display_sync_error;
frame->num_vsyncs = num_vsyncs;
frame->display_synced = true;
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c
index 4c62efe3be..7f0bb22b8f 100644
--- a/video/out/opengl/video.c
+++ b/video/out/opengl/video.c
@@ -2088,7 +2088,7 @@ static void gl_video_interpolate_frame(struct gl_video *p, struct vo_frame *t,
double pts_now = p->surfaces[surface_now].pts,
pts_nxt = p->surfaces[surface_nxt].pts;
- double mix = (t->vsync_offset / 1e6) / (pts_nxt - pts_now);
+ double mix = t->vsync_offset / (pts_nxt - pts_now);
// The scaler code always wants the fcoord to be between 0 and 1,
// so we try to adjust by using the previous set of N frames instead
// (which requires some extra checking to make sure it's valid)
@@ -2107,7 +2107,7 @@ static void gl_video_interpolate_frame(struct gl_video *p, struct vo_frame *t,
// Blend the frames together
if (oversample) {
- double vsync_dist = t->vsync_interval / 1e6 / (pts_nxt - pts_now),
+ double vsync_dist = t->vsync_interval / (pts_nxt - pts_now),
threshold = tscale->conf.kernel.params[0];
threshold = isnan(threshold) ? 0.0 : threshold;
mix = (1 - mix) / vsync_dist;
@@ -2130,8 +2130,7 @@ static void gl_video_interpolate_frame(struct gl_video *p, struct vo_frame *t,
}
MP_STATS(p, "frame-mix");
- MP_DBG(p, "inter frame pts: %lld, vsync: %lld, mix: %f\n",
- (long long)t->pts, (long long)t->vsync_interval, mix);
+ MP_DBG(p, "inter frame vsync: %f, mix: %f\n", t->vsync_interval, mix);
p->is_interpolated = true;
}
pass_draw_to_screen(p, fbo);
diff --git a/video/out/vo.c b/video/out/vo.c
index 7d39c7e613..a3254d8866 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -741,8 +741,6 @@ static bool render_frame(struct vo *vo)
int64_t duration = frame->duration;
int64_t end_time = pts + duration;
- frame->vsync_interval = in->vsync_interval;
-
// Time at which we should flip_page on the VO.
int64_t target = frame->display_synced ? 0 : pts - in->flip_queue_offset;
@@ -761,7 +759,7 @@ static bool render_frame(struct vo *vo)
// frame currently drawn, while in->current_frame is the potentially next.)
in->current_frame->repeat = true;
if (frame->display_synced) {
- in->current_frame->vsync_offset += in->vsync_interval;
+ in->current_frame->vsync_offset += in->current_frame->vsync_interval;
in->dropped_frame |= in->current_frame->num_vsyncs < 1;
}
if (in->current_frame->num_vsyncs > 0)
diff --git a/video/out/vo.h b/video/out/vo.h
index 05c50bb3dd..051638882b 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -165,9 +165,9 @@ struct vo_frame {
// Approximate frame duration, in us.
int duration;
// Realtime of estimated distance between 2 vsync events.
- int64_t vsync_interval;
+ double vsync_interval;
// "ideal" display time within the vsync
- int64_t vsync_offset;
+ double vsync_offset;
// how often the frame will be repeated (does not include OSD redraws)
int num_vsyncs;
// Set if the current frame is repeated from the previous. It's guaranteed