[vlc-devel] [PATCH 0/1] Improve SFTP network performance with buffer

Ilkka Ollakka ileoo at videolan.org
Wed Feb 14 17:13:45 CET 2018

On Wed, Feb 14, 2018 at 03:05:00PM +0100, Martin Disch wrote:
> Streaming video files over SFTP does not currently work well when the source
> is not on the local area network, but somewhere on the internet where there
> is some latency instead. Playback often stops to load more data and
> when looking at the bandwidth usage, VLC doesn't use more than 8-10 Mbit/s,
> even though my connection can offer more than 20 times that.

> Here are the buffer sizes compared to the peak network utilization when
> playing and skipping through the same video file:
>   1 MiB -> 40 Mbit/s
>  10 MiB -> 100 Mbit/s
> 100 MiB -> 220 Mbit/s
> Seeing this, ideally the buffer size would be made available as an option in
> the settings of the module. But since the 1 MiB buffer alone increases
> performance by quite a bit at practically no cost and I wanted to keep this
> simple, that's what I opted for.


One think that could help is to just change 
ACCESS_SET_CALLBACKS( Read, NULL, Control, Seek ); in line 460 to form
ACCESS_SET_CALLBACKS( NULL, Read, Control, Seek );

And change the Read-function to form of (block_t *read( stream_t
*access, bool *eof). This means that Read function would return
actual block instead of filling buffer.

I think in that case the prefetch-filter should handle the caching and
reading in bigger chunks. Also it seems that pf_read-cases (what sftp
seems to do currently), reads are done in around 4k sizes, as in
pf_block-case you could define internally for sftp-access to read/return
1M blocks?

Ilkka Ollakka

More information about the vlc-devel mailing list