diff options
author | wm4 <wm4@nowhere> | 2014-04-09 19:07:50 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-04-09 19:07:50 +0200 |
commit | 6ac98c042f16d6b6a6f370905345678b42adf9e8 (patch) | |
tree | 6d27721200a7ade77e4affa0ba7d9c55e5d8491e /stream/cache.c | |
parent | a967152498aa0302d83fe5e70509f7210b123deb (diff) | |
download | mpv-6ac98c042f16d6b6a6f370905345678b42adf9e8.tar.bz2 mpv-6ac98c042f16d6b6a6f370905345678b42adf9e8.tar.xz |
cache: minor simplification
The only difference is that the MP_DBG message is not printed anymore if
the current user read position is outside of the current cache range.
(In order to handle seek_limit==0 gracefully in the normal case of
linear reading, change the comparison from ">=" to ">".)
Diffstat (limited to 'stream/cache.c')
-rw-r--r-- | stream/cache.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/stream/cache.c b/stream/cache.c index c992764522..6333eeb0e9 100644 --- a/stream/cache.c +++ b/stream/cache.c @@ -240,19 +240,15 @@ static bool cache_fill(struct priv *s) int64_t read = s->read_filepos; int len; - if (read < s->min_filepos || read > s->max_filepos) { - // seek... - MP_DBG(s, "Out of boundaries... seeking to %" PRId64 " \n", read); - // drop cache contents only if seeking backward or too much fwd. - // This is also done for on-disk files, since it loses the backseek cache. - // That in turn can cause major bandwidth increase and performance - // issues with e.g. mov or badly interleaved files - if (read < s->min_filepos || read >= s->max_filepos + s->seek_limit) { - MP_VERBOSE(s, "Dropping cache at pos %"PRId64", " + // drop cache contents only if seeking backward or too much fwd. + // This is also done for on-disk files, since it loses the backseek cache. + // That in turn can cause major bandwidth increase and performance + // issues with e.g. mov or badly interleaved files + if (read < s->min_filepos || read > s->max_filepos + s->seek_limit) { + MP_VERBOSE(s, "Dropping cache at pos %"PRId64", " "cached range: %"PRId64"-%"PRId64".\n", read, s->min_filepos, s->max_filepos); - cache_drop_contents(s); - } + cache_drop_contents(s); } if (stream_tell(s->stream) != s->max_filepos) { |