summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-11-10 16:30:43 +0100
committerwm4 <wm4@nowhere>2017-11-10 16:30:43 +0100
commit1b0dc7d169cc7ef3ef20727781b1e8fee5ca159f (patch)
tree93e3e9a7c286c3fdab37ce8e60dbb03993f5975d /demux
parent618b8a33e5ed0acbe59ec62ab11f9aabf76ef0cd (diff)
downloadmpv-1b0dc7d169cc7ef3ef20727781b1e8fee5ca159f.tar.bz2
mpv-1b0dc7d169cc7ef3ef20727781b1e8fee5ca159f.tar.xz
demux: use seekable cache for network by default, bump prefetch limit
The option for enabling it has now an "auto" choice, which is the default, and which will enable it if the media is thought to be via network or if the stream cache is enabled (same logic as --cache-secs). Also bump the --cache-secs default from 10 to 120.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/demux/demux.c b/demux/demux.c
index 2a46ac730f..b66ed9abbb 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -104,7 +104,8 @@ const struct m_sub_options demux_conf = {
OPT_FLAG("force-seekable", force_seekable, 0),
OPT_DOUBLE("cache-secs", min_secs_cache, M_OPT_MIN, .min = 0),
OPT_FLAG("access-references", access_references, 0),
- OPT_FLAG("demuxer-seekable-cache", seekable_cache, 0),
+ OPT_CHOICE("demuxer-seekable-cache", seekable_cache, 0,
+ ({"auto", -1}, {"no", 0}, {"yes", 1})),
OPT_FLAG("sub-create-cc-track", create_ccs, 0),
{0}
},
@@ -113,7 +114,8 @@ const struct m_sub_options demux_conf = {
.max_bytes = 400 * 1024 * 1024,
.max_bytes_bw = 400 * 1024 * 1024,
.min_secs = 1.0,
- .min_secs_cache = 10.0,
+ .min_secs_cache = 120.0,
+ .seekable_cache = -1,
.access_references = 1,
},
};
@@ -155,7 +157,7 @@ struct demux_internal {
double min_secs;
int max_bytes;
int max_bytes_bw;
- int seekable_cache;
+ bool seekable_cache;
// At least one decoder actually requested data since init or the last seek.
// Do this to allow the decoder thread to select streams before starting.
@@ -1947,7 +1949,6 @@ static struct demuxer *open_given_type(struct mpv_global *global,
.min_secs = opts->min_secs,
.max_bytes = opts->max_bytes,
.max_bytes_bw = opts->max_bytes_bw,
- .seekable_cache = opts->seekable_cache,
.initial_state = true,
};
pthread_mutex_init(&in->lock, NULL);
@@ -2016,8 +2017,13 @@ static struct demuxer *open_given_type(struct mpv_global *global,
}
}
}
- if (demuxer->is_network || stream->caching)
+ int seekable = opts->seekable_cache;
+ if (demuxer->is_network || stream->caching) {
in->min_secs = MPMAX(in->min_secs, opts->min_secs_cache);
+ if (seekable < 0)
+ seekable = 1;
+ }
+ in->seekable_cache = seekable == 1;
return demuxer;
}