path: root/player/video.c
diff options
authorwm4 <wm4@nowhere>2014-08-15 23:33:33 +0200
committerwm4 <wm4@nowhere>2014-08-15 23:33:33 +0200
commit543ba6c114303c8c3a71b37864f6d901c41808eb (patch)
tree3735649107f6df38de3adaf9081ecb672546c7a3 /player/video.c
parent22a95290126398c1f416dbadaf596ba79c872996 (diff)
video: add VO framedropping mode
This mostly uses the same idea as with vo_vdpau.c, but much simplified. On X11, it tries to get the display framerate with XF86VM, and limits the frequency of new video frames against it. Note that this is an old extension, and is confirmed not to work correctly with multi-monitor setups. But we're using it because it was already around (it is also used by vo_vdpau). This attempts to predict the next vsync event by using the time of the last frame and the display FPS. Even if that goes completely wrong, the results are still relatively good. On other systems, or if the X11 code doesn't return a display FPS, a framerate of 1000 is assumed. This is infinite for all practical purposes, and means that only frames which are definitely too late are dropped. This probably has worse results, but is still useful. "--framedrop=yes" is basically replaced with "--framedrop=decoder". The old framedropping mode is kept around, and should perhaps be improved. Dropping on the decoder level is still useful if decoding itself is too slow.
Diffstat (limited to 'player/video.c')
1 files changed, 4 insertions, 4 deletions
diff --git a/player/video.c b/player/video.c
index 43b51bfd58..ffe24e621c 100644
--- a/player/video.c
+++ b/player/video.c
@@ -278,8 +278,7 @@ int reinit_video_chain(struct MPContext *mpctx)
vo_control(mpctx->video_out, saver_state ? VOCTRL_RESTORE_SCREENSAVER
- vo_control(mpctx->video_out, mpctx->paused ? VOCTRL_PAUSE
+ vo_set_paused(mpctx->video_out, mpctx->paused);
mpctx->sync_audio_to_video = !sh->attached_picture;
@@ -343,7 +342,7 @@ static int check_framedrop(struct MPContext *mpctx)
if (d < -mpctx->dropped_frames * frame_time - 0.100) {
- return mpctx->opts->frame_dropping;
+ return !!(mpctx->opts->frame_dropping & 2);
} else
mpctx->dropped_frames = 0;
@@ -576,7 +575,8 @@ static int update_video(struct MPContext *mpctx, double endpts)
- bool vo_framedrop = !!mpctx->video_out->driver->flip_page_timed;
+ //bool vo_framedrop = !!mpctx->video_out->driver->flip_page_timed;
+ bool vo_framedrop = !!(mpctx->opts->frame_dropping & 1);
int min_frames = vo_framedrop ? 2 : 1; // framedrop needs duration
// Already enough video buffered?