summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/video.c6
-rw-r--r--video/out/vo.c8
-rw-r--r--video/out/vo.h1
3 files changed, 15 insertions, 0 deletions
diff --git a/player/video.c b/player/video.c
index e3295b623a..9790f34966 100644
--- a/player/video.c
+++ b/player/video.c
@@ -1209,6 +1209,12 @@ static void handle_display_sync_frame(struct MPContext *mpctx,
// Likewise, we know sync is off, but is going to be compensated.
time_left += drop_repeat * vsync;
+ // If syncing took too long, disregard timing of the first frame.
+ if (mpctx->num_past_frames == 2 && time_left < 0) {
+ vo_discard_timing_info(vo);
+ time_left = 0;
+ }
+
if (drop_repeat) {
mpctx->mistimed_frames_total += 1;
MP_STATS(mpctx, "mistimed");
diff --git a/video/out/vo.c b/video/out/vo.c
index 2804687e5e..aa92d349e5 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -1096,6 +1096,14 @@ double vo_get_delay(struct vo *vo)
return res ? (res - mp_time_us()) / 1e6 : 0;
}
+void vo_discard_timing_info(struct vo *vo)
+{
+ struct vo_internal *in = vo->in;
+ pthread_mutex_lock(&in->lock);
+ reset_vsync_timings(vo);
+ pthread_mutex_unlock(&in->lock);
+}
+
int64_t vo_get_delayed_count(struct vo *vo)
{
struct vo_internal *in = vo->in;
diff --git a/video/out/vo.h b/video/out/vo.h
index 511954c153..a5280e5611 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -366,6 +366,7 @@ double vo_get_estimated_vsync_interval(struct vo *vo);
double vo_get_estimated_vsync_jitter(struct vo *vo);
double vo_get_display_fps(struct vo *vo);
double vo_get_delay(struct vo *vo);
+void vo_discard_timing_info(struct vo *vo);
void vo_wakeup(struct vo *vo);
void vo_wait_default(struct vo *vo, int64_t until_time);