summaryrefslogtreecommitdiffstats
path: root/stream/cache.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-19 23:27:09 +0200
committerwm4 <wm4@nowhere>2014-05-20 02:40:22 +0200
commit4664f8b3b7cd5089463623df02655ec11e258671 (patch)
tree1dfe5ed9633762ec8f50deabaa4e23b24104f401 /stream/cache.c
parentac66bcc25955b41f71202273490d4073a013a7db (diff)
downloadmpv-4664f8b3b7cd5089463623df02655ec11e258671.tar.bz2
mpv-4664f8b3b7cd5089463623df02655ec11e258671.tar.xz
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.
Diffstat (limited to 'stream/cache.c')
-rw-r--r--stream/cache.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/stream/cache.c b/stream/cache.c
index 6079f6b976..95ece34a8c 100644
--- a/stream/cache.c
+++ b/stream/cache.c
@@ -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;