diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2016-10-20 21:16:41 +0100 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2016-10-20 21:18:57 +0100 |
commit | 04fb5d1083c4b523318d3fa4f398919408df1e7d (patch) | |
tree | f646f3e512ce490454a265821828d1eb6c2c675f /src | |
parent | f33b1a4a966e612a563ef761fdb55ef25e67136b (diff) | |
download | imv-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')
-rw-r--r-- | src/main.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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); } |