cache: redo options and default settings

Some options change from percentages to number of kilobytes; there are
no cache options using percentages anymore.

Raise the default values. The cache is now 25000 kilobytes, although if
your connection is slow enough, the maximum is probably never reached.
(Although all the memory will still be used as seekback-cache.)

Remove the separate --audio-file-cache option, and use the cache default
settings for it.
This commit is contained in:
wm4
2014-05-19 23:27:09 +02:00
parent ac66bcc259
commit 4664f8b3b7
12 changed files with 95 additions and 101 deletions

View File

@@ -56,6 +56,7 @@
#include "osdep/threads.h"
#include "common/msg.h"
#include "options/options.h"
#include "stream.h"
#include "common/common.h"
@@ -655,18 +656,18 @@ static void cache_uninit(stream_t *cache)
// return 1 on success, 0 if the function was interrupted and -1 on error, or
// if the cache is disabled
int stream_cache_init(stream_t *cache, stream_t *stream, int64_t size,
int64_t min, int64_t seek_limit)
int stream_cache_init(stream_t *cache, stream_t *stream,
struct mp_cache_opts *opts)
{
if (size < 1)
if (opts->size < 1)
return -1;
struct priv *s = talloc_zero(NULL, struct priv);
s->log = cache->log;
s->seek_limit = seek_limit;
s->seek_limit = opts->seek_min * 1024ULL;
if (resize_cache(s, size) != STREAM_OK) {
if (resize_cache(s, opts->size * 1024ULL) != STREAM_OK) {
MP_ERR(s, "Failed to allocate cache buffer.\n");
talloc_free(s);
return -1;
@@ -687,6 +688,7 @@ int stream_cache_init(stream_t *cache, stream_t *stream, int64_t size,
cache->control = cache_control;
cache->close = cache_uninit;
int64_t min = opts->initial * 1024ULL;
if (min > s->buffer_size - FILL_LIMIT)
min = s->buffer_size - FILL_LIMIT;