aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2016-10-20 21:16:41 +0100
committerHarry Jeffery <harry@exec64.co.uk>2016-10-20 21:18:57 +0100
commit04fb5d1083c4b523318d3fa4f398919408df1e7d (patch)
treef646f3e512ce490454a265821828d1eb6c2c675f /src/main.c
parentf33b1a4a966e612a563ef761fdb55ef25e67136b (diff)
downloadimv-04fb5d1083c4b523318d3fa4f398919408df1e7d.tar.gz
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.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c6
1 files changed, 6 insertions, 0 deletions
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);
}