From 65f107686e6449de6b3cb603397a7f2aa0e60f8b Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Thu, 26 Jan 2017 09:24:35 +0200 Subject: Drop only half frames, add warning for drops --- glcapture.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'glcapture.c') diff --git a/glcapture.c b/glcapture.c index 37a0e81..d1c7b89 100644 --- a/glcapture.c +++ b/glcapture.c @@ -455,10 +455,12 @@ capture_frame(struct gl *gl, const GLint view[4]) { static __thread uint64_t last_time; const uint64_t ts = get_time_ns(); - const uint64_t rate = 1e9 / FPS; + const uint64_t rate = (1e9 / FPS) / 2; - if (DROP_FRAMES && last_time > 0 && ts - last_time < rate) + if (DROP_FRAMES && last_time > 0 && ts - last_time <= rate) { + WARNX("WARNING: dropping frame (%.2f <= %.2f)", (ts - last_time) / 1e6, rate / 1e6); return; + } last_time = ts; -- cgit v1.2.3