From 031555fbe6cfdf6d0db3b0a5a316dd55efd75846 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 10 Aug 2015 18:43:25 +0200 Subject: player: add display sync mode If this mode is enabled, the player tries to strictly synchronize video to display refresh. It will adjust playback speed to match the display, so if you play 23.976 fps video on a 24 Hz screen, playback speed is increased by approximately 1/1000. Audio wll be resampled to keep up with playback. This is different from the default sync mode, which will sync video to audio, with the consequence that video might skip or repeat a frame once in a while to make video keep up with audio. This is still unpolished. There are some major problems as well; in particular, mkv VFR files won't work well. The reason is that Matroska is terrible and rounds timestamps to milliseconds. This makes it rather hard to guess the framerate of a section of video that is playing. We could probably fix this by just accepting jittery timestamps (instead of explicitly disabling the sync code in this case), but I'm not ready to accept such a solution yet. Another issue is that we are extremely reliant on OS video and audio APIs working in an expected manner, which of course is not too often the case. Consequently, the new sync mode is a bit fragile. --- player/osd.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'player/osd.c') diff --git a/player/osd.c b/player/osd.c index 0bdb368f7e..ace465b18d 100644 --- a/player/osd.c +++ b/player/osd.c @@ -225,6 +225,12 @@ static void print_status(struct MPContext *mpctx) { // VO stats if (mpctx->d_video) { + if (mpctx->display_sync_active) { + saddf(&line, " DS: %f", mpctx->speed_factor_a); + int64_t m = vo_get_missed_count(mpctx->video_out); + if (m > 0) + saddf(&line, " Missed: %"PRId64, m); + } int64_t c = vo_get_drop_count(mpctx->video_out); if (c > 0 || mpctx->dropped_frames_total > 0) { saddf(&line, " Dropped: %"PRId64, c); -- cgit v1.2.3