path: root/player/video.c
diff options
authorwm4 <wm4@nowhere>2019-10-17 19:23:35 +0200
committerwm4 <wm4@nowhere>2019-10-17 19:23:35 +0200
commit273cc3055cb5829fe62dce88e596c21ae85ef1c2 (patch)
tree8d9ba90ad2d159d3dbc75e2681b1221ae547b5a7 /player/video.c
parent2fcd5271eb045e235c281faa73d8676c4bcea4b3 (diff)
video: do not disable display-sync on A/V desync
On a audio/video desync by more than 0.5 seconds, display-sync mode was disabled, and not enabled again (until playback restart, e.g. a seek). The idea was that it this only happens when this playback mode is broken and can't perform well anyway (A/V desync is a clear indication that something is very wrong). Instead of behaving like a god damn POS, it should revert to the more robust audio-sync mode. Unfortunately, this could happen sporadically due to temporary system performance problems, such as toggling fullscreen. Users didn't like this, and asked for a function to disable it, or to recover in some other way. This mechanism is questionable anyway. If an ignorant user enables display-sync, and encounters problems with it (without being able to determine that display-sync is messing up), the player will still behave like a POS on every playback, and even after every seek. It might actually be helpful to fail more consistently. Also, I've found that it's sill relatively reliable anyway even without this mechanism. So just remove the fallback. Fixes: #7048
Diffstat (limited to 'player/video.c')
1 files changed, 2 insertions, 8 deletions
diff --git a/player/video.c b/player/video.c
index 680636b075..7e24502e8c 100644
--- a/player/video.c
+++ b/player/video.c
@@ -118,7 +118,6 @@ void reset_video_state(struct MPContext *mpctx)
mpctx->mistimed_frames_total = 0;
mpctx->drop_message_shown = 0;
mpctx->display_sync_drift_dir = 0;
- mpctx->display_sync_broken = false;
mpctx->video_status = mpctx->vo_chain ? STATUS_SYNCING : STATUS_EOF;
@@ -781,7 +780,7 @@ static void handle_display_sync_frame(struct MPContext *mpctx,
mpctx->display_sync_active = false;
- if (!VS_IS_DISP(mode) || mpctx->display_sync_broken)
+ if (!VS_IS_DISP(mode))
bool resample = mode == VS_DISP_RESAMPLE || mode == VS_DISP_RESAMPLE_VDROP ||
@@ -809,12 +808,6 @@ static void handle_display_sync_frame(struct MPContext *mpctx,
mpctx->speed_factor_v = best;
- double av_diff = mpctx->last_av_difference;
- if (fabs(av_diff) > 0.5) {
- mpctx->display_sync_broken = true;
- return;
- }
// Determine for how many vsyncs a frame should be displayed. This can be
// e.g. 2 for 30hz on a 60hz display. It can also be 0 if the video
// framerate is higher than the display framerate.
@@ -830,6 +823,7 @@ static void handle_display_sync_frame(struct MPContext *mpctx,
mpctx->display_sync_error, mpctx->display_sync_error / vsync,
mpctx->display_sync_error / frame_duration);
+ double av_diff = mpctx->last_av_difference;
MP_STATS(mpctx, "value %f avdiff", av_diff);
// Intended number of additional display frames to drop (<0) or repeat (>0)