More intelligent video cache for backwards seeking
|Reported by:||rmrm||Owned by:|
Apparently Aegisub keeps a cache of the last 8 decoded frames to avoid lengthly seeks.
However, when seeking backwards frame-by-frame, once you escape the cache, every new frame takes a lengthy seek, which is quite painful.
A better way to handle this is, when seeking backwards, fetch the frame 7 frames before the requested one, or the nearest keyframe, whichever is closer. Then fetch all the frames sequentially until the desired one.
This cuts the number of expensive seeks to 1/8, and doesn't make them much slower than before (barring a few memory copies). Going to the next frame is no problem either: since you just decoded the last frame, decoding the very next one is fast even if it isn't on the cache - no seek required from the decoder.
An option to configure the number of cached frames would be nice too.