diff options
author | wm4 <wm4@nowhere> | 2015-05-29 22:32:10 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-05-29 22:32:10 +0200 |
commit | 5bea9668362866bd4db0557f387a3b185ac34315 (patch) | |
tree | ca77c6edeeccfa1413ab6d3f6213e7ae16d0d589 /stream/stream_mf.c | |
parent | 20bc56b22d7b1679d2cd83fec216697b8b922a09 (diff) |
cache: limit readahead size to half the cache size at the beginning
Normally, the cache keeps 50% of the buffer for seeking backwards. Until
now, the cache just used the full buffer size at the beginning of a
file, because the 50% normally reserved for the backbuffer are unused.
This caused a problem: when streaming from http, the player would first
read about 150MB (default cache size), then stop until 75MB of the cache
has been played. (Until the 75MB position, the cache is fully used, so
nothing new can be read. After that, part of the backbuffer starts
getting unreserved, and can be used for readahead.) This long read pause
can cause the server to terminate the connection. Reconnecting may be
possible, but if youtube-dl is used, the media URL may have become
invalid.
Fix this by limiting readahead to 50% even if unnecessary. The only
exception is when the whole file would fit in the cache. In this case,
it won't matter if we can't reconnect, because the cache covers
everything anyway, and hopefully the cache will stay valid.
Likely fixes #2000.
Diffstat (limited to 'stream/stream_mf.c')
0 files changed, 0 insertions, 0 deletions