Skip to content

Draft: speed-up "meta reader" modules

Thomas Guillem requested to merge tguillem/vlc:meta-stream into master

This MR add the possibility to use the same access stream between the "meta reader" and the input_source_t.

Huge gain when using a network stream.

Tested with SMB via WIFI, when parsing a mp3:

  • before: 300 - 500ms,
  • after: 3 - 15 ms.

There is also a slight gain with local files. Around 50% faster (since it re-use the same prefetch/cache), from 30ms to 15ms approximately.

It's a Draft because there is a WIP comment that need your attention.

The main issue is to not mess with the demux state, that expect its stream to be at the same position after leaving the Open(). That is why I save the initial stream offset before re-using it, and seek back to the initial position after.

But the seek failure is not handled yet. I propose that we make the input_source_t fail (and the input_thead_t if it's the main one) if we cannot restore the stream position (unlikely situation).

If we need to prevent the "meta reader" to mess with the stream state, we can also create a "shallow copy" of the access stream, that will only be able to seek and read.

Merge request reports