mirror of
https://github.com/mpv-player/mpv
synced 2025-01-02 04:42:10 +00:00
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.
This commit is contained in:
parent
65099833f7
commit
3836bfb1ad
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user