Skip to content

per-stream cache

David Vorick requested to merge stream-cache into unstable

Due to performance issues with partial downloads, I've implemented a per-stream cache that defaults to 256 KiB of cache. As soon as streaming starts, the first 256 KiB get retrieved. As more data is read, the cache is replenished. A feedback mechanism checks and boosts the cache size where necessary.

I haven't tested this code yet, and the implementation is pretty sloppy overall. I intend to clean this up a bit and add the appropriate testing before removing the WIP status.

Unlike previously, this caching doesn't require specifying a total number of streams - each stream gets its own cache, the caches aren't shared at all (at least, not yet - support could be added for that but is probably not needed), and you don't need to adjust any api settings to support more or fewer streams as your use case changes.

Testing will confirm, but if the implementation is correct then streaming apps like VLC should be able to now get the best of both worlds: buttery smooth playback like we had when we were cacheing whole chunks, but also highly responsive seek times due to needing to only fetch 256-1024 KiB of data at a time, instead of 40 MiB.

Edited by David Vorick

Merge request reports