From 4664f8b3b7cd5089463623df02655ec11e258671 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 19 May 2014 23:27:09 +0200 Subject: 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. --- player/playloop.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'player/playloop.c') diff --git a/player/playloop.c b/player/playloop.c index 9e7a673f73..835d9b0bec 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -650,17 +650,21 @@ static void handle_metadata_update(struct MPContext *mpctx) static void handle_pause_on_low_cache(struct MPContext *mpctx) { struct MPOpts *opts = mpctx->opts; - int cache = mp_get_cache_percent(mpctx); + if (!mpctx->stream) + return; + int64_t fill = -1; + stream_control(mpctx->stream, STREAM_CTRL_GET_CACHE_FILL, &fill); + int cache_kb = fill > 0 ? (fill + 1023) / 1024 : -1; bool idle = mp_get_cache_idle(mpctx); if (mpctx->paused && mpctx->paused_for_cache) { - if (cache < 0 || cache >= opts->stream_cache_min_percent || idle) { + if (cache_kb < 0 || cache_kb >= opts->stream_cache_unpause || idle) { mpctx->paused_for_cache = false; if (!opts->pause) unpause_player(mpctx); } } else { - if (cache >= 0 && cache <= opts->stream_cache_pause && !idle && - opts->stream_cache_pause < opts->stream_cache_min_percent) + if (cache_kb >= 0 && cache_kb <= opts->stream_cache_pause && !idle && + opts->stream_cache_pause < opts->stream_cache_unpause) { bool prev_paused_user = opts->pause; pause_player(mpctx); -- cgit v1.2.3