From 7c4fe02d01322ad09954d63522c0c8bf3f06b3d1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 11 Nov 2015 19:52:35 +0100 Subject: player: less naive rounding --- player/video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/player/video.c b/player/video.c index d09cf3800a..0aebc6a7e9 100644 --- a/player/video.c +++ b/player/video.c @@ -1004,7 +1004,7 @@ static void handle_display_sync_frame(struct MPContext *mpctx, // We use the speed-adjusted (i.e. real) frame duration for this. double frame_duration = adjusted_duration / mpctx->speed_factor_v; double ratio = (frame_duration + mpctx->display_sync_error) / vsync; - int num_vsyncs = MPMAX(floor(ratio + 0.5), 0); + 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; -- cgit v1.2.3