From 3d1cc17ab27b98294f5710e69250e95347d84598 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 10 Aug 2015 18:38:57 +0200 Subject: player: redo estimated-vf-fps calculation Additionally to taking the average, this tries to use the demuxer FPS to eliminate jitter, and applies some other heuristics to check if the result is sane. This code will also be used for the display sync code (it will actually make use of the require_exact parameter). (The value of doing this over keeping the simpler demux_mkv hack is somewhat questionable. But at least it allows us to deal with other container formats that use jittery timestamps, such as mp4 remuxed from mkv.) --- player/core.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'player/core.h') diff --git a/player/core.h b/player/core.h index c34d2ddd6d..75dd2edec7 100644 --- a/player/core.h +++ b/player/core.h @@ -76,6 +76,9 @@ enum seek_precision { MPSEEK_VERY_EXACT, }; +// Comes from the assumption that some formats round timestamps to ms. +#define FRAME_DURATION_TOLERANCE 0.0011 + struct track { enum stream_type type; @@ -235,6 +238,7 @@ typedef struct MPContext { enum playback_status video_status, audio_status; bool restart_complete; + bool broken_fps_header; /* Set if audio should be timed to start with video frame after seeking, * not set when e.g. playing cover art */ bool sync_audio_to_video; @@ -488,5 +492,6 @@ void write_video(struct MPContext *mpctx, double endpts); void mp_force_video_refresh(struct MPContext *mpctx); void uninit_video_out(struct MPContext *mpctx); void uninit_video_chain(struct MPContext *mpctx); +double stabilize_frame_duration(struct MPContext *mpctx, bool require_exact); #endif /* MPLAYER_MP_CORE_H */ -- cgit v1.2.3