summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-13 22:45:40 +0100
committerwm4 <wm4@nowhere>2015-11-13 22:45:40 +0100
commitd32c4c75ef1cf4d69474a0a0e8f8127e77910099 (patch)
tree355fdc7b230f4b544dfb5d23a8d174a347c793fb /player/loadfile.c
parent624c9e46ce0bb4f547ffaf9cd6541700cea96ddb (diff)
downloadmpv-d32c4c75ef1cf4d69474a0a0e8f8127e77910099.tar.bz2
mpv-d32c4c75ef1cf4d69474a0a0e8f8127e77910099.tar.xz
player: refactor display-sync frame duration calculations
Get rid of get_past_frame_durations(), which was a bit too messy. Add a past_frames array, which contains the same information in a more reasonable way. This also means that we can get the exact current and past frame durations without going through awful stuff. (The main problem is that vo_pts_history contains future frames as well, which is needed for frame backstepping etc., but gets in the way here.) Also disable the automatic disabling of display-sync if the frame duration changes, and extend the frame durations allowed for display sync. To allow arbitrarily high durations, vo.c needs to be changed to pause and potentially redraw OSD while showing a single frame, so they're still limited. In an attempt to deal with VFR, calculate the overall speed using the average FPS. The frame scheduling itself does not use the average FPS, but the duration of the current frame. This does not work too well, but provides a good base for further improvements. Where this commit actually helps a lot is dealing with rounded timestamps, e.g. if the container framerate is wrong or unknown, or if the muxer wrote incorrectly rounded timestamps. While the rounding errors apparently can't be get rid of completely in the general case, this is still much better than e.g. disabling display-sync completely just because some frame durations go out of bounds.
Diffstat (limited to 'player/loadfile.c')
-rw-r--r--player/loadfile.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index c472cad344..d72f13da61 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -1034,7 +1034,6 @@ static void play_current_file(struct MPContext *mpctx)
mpctx->max_frames = -1;
mpctx->video_speed = mpctx->audio_speed = opts->playback_speed;
mpctx->speed_factor_a = mpctx->speed_factor_v = 1.0;
- mpctx->display_sync_frameduration = 0.0;
mpctx->display_sync_error = 0.0;
mpctx->broken_fps_header = false;
mpctx->display_sync_active = false;