From 04fb5d1083c4b523318d3fa4f398919408df1e7d Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Thu, 20 Oct 2016 21:16:41 +0100 Subject: Cap playback delta-time to 100 ms This prevents imv from trying to "catch up" on the time that it was asleep for by playing the gif back at high speed. --- src/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.c b/src/main.c index 812688a..2671a21 100644 --- a/src/main.c +++ b/src/main.c @@ -546,6 +546,12 @@ int main(int argc, char** argv) * passed */ if(view.playing) { unsigned int dt = current_time - last_time; + /* We cap the delta-time to 100 ms so that if imv is asleep for several + * seconds or more (e.g. suspended), upon waking up it doesn't try to + * catch up all the time it missed by playing through the gif quickly. */ + if(dt > 100) { + dt = 100; + } imv_loader_time_passed(&ldr, dt / 1000.0); } -- cgit v1.2.3