summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-09 22:34:58 +0200
committerwm4 <wm4@nowhere>2014-04-09 22:34:58 +0200
commit3836bfb1ad6a08e96e1ce88428c932f0b7766950 (patch)
tree8b76267c73b35e886dc8a7a0c6fc3e100bb96a73 /stream
parent65099833f7c9bd1a626595bb40b614bfa2e3a401 (diff)
downloadmpv-3836bfb1ad6a08e96e1ce88428c932f0b7766950.tar.bz2
mpv-3836bfb1ad6a08e96e1ce88428c932f0b7766950.tar.xz
cache: fix checks/output on initialization
resize_cache() checks the size itself and clamps the size to the valid range if necessary, so we don't need these checks. In fact, the checks are different. Also, output the cache size after clamping, instead of before.
Diffstat (limited to 'stream')
-rw-r--r--stream/cache.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/stream/cache.c b/stream/cache.c
index 27c9a30b22..64c993975e 100644
--- a/stream/cache.c
+++ b/stream/cache.c
@@ -659,14 +659,6 @@ int stream_cache_init(stream_t *cache, stream_t *stream, int64_t size,
if (size < 1)
return -1;
- MP_INFO(cache, "Cache size set to %" PRId64 " KiB\n",
- size / 1024);
-
- if (size > SIZE_MAX) {
- MP_FATAL(cache, "Cache size larger than max. allocation size\n");
- return -1;
- }
-
struct priv *s = talloc_zero(NULL, struct priv);
s->log = cache->log;
@@ -678,6 +670,9 @@ int stream_cache_init(stream_t *cache, stream_t *stream, int64_t size,
return -1;
}
+ MP_INFO(cache, "Cache size set to %" PRId64 " KiB\n",
+ s->buffer_size / 1024);
+
pthread_mutex_init(&s->mutex, NULL);
pthread_cond_init(&s->wakeup, NULL);