diff options
author | wm4 <wm4@nowhere> | 2015-08-10 18:38:57 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-08-10 18:38:57 +0200 |
commit | 3d1cc17ab27b98294f5710e69250e95347d84598 (patch) | |
tree | 5c38e248a621027277ca8636f4aa06ed2a74ceb2 /player/command.c | |
parent | 8f2d9db79fc2f542b2973f245cc6b93fd35c1d80 (diff) | |
download | mpv-3d1cc17ab27b98294f5710e69250e95347d84598.tar.bz2 mpv-3d1cc17ab27b98294f5710e69250e95347d84598.tar.xz |
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.)
Diffstat (limited to 'player/command.c')
-rw-r--r-- | player/command.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/player/command.c b/player/command.c index cb565df896..c87d9378b7 100644 --- a/player/command.c +++ b/player/command.c @@ -2625,14 +2625,10 @@ static int mp_property_vf_fps(void *ctx, struct m_property *prop, MPContext *mpctx = ctx; if (!mpctx->d_video) return M_PROPERTY_UNAVAILABLE; - double durations[10]; - int num = get_past_frame_durations(mpctx, durations, MP_ARRAY_SIZE(durations)); - if (num < MP_ARRAY_SIZE(durations)) + double res = stabilize_frame_duration(mpctx, false); + if (res <= 0) return M_PROPERTY_UNAVAILABLE; - double duration = 0; - for (int n = 0; n < num; n++) - duration += durations[n]; - return m_property_double_ro(action, arg, num / duration); + return m_property_double_ro(action, arg, 1 / res); } /// Video aspect (RO) |