summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-27 01:13:20 +0200
committerwm4 <wm4@nowhere>2014-08-27 03:39:04 +0200
commit0b428e44829abc4387f051e3c618c1c878b3a838 (patch)
tree994e0580c831642fde1f2ff6918814404c61deae /options
parenta8513f8b37343c27a4abea380ae0aa6bbae3894c (diff)
downloadmpv-0b428e44829abc4387f051e3c618c1c878b3a838.tar.bz2
mpv-0b428e44829abc4387f051e3c618c1c878b3a838.tar.xz
player: redo how stream caching and pausing on low cache works
Add the --cache-secs option, which literally overrides the value of --demuxer-readahead-secs if the stream cache is active. The default value is very high (10 seconds), which means it can act as network cache. Remove the old behavior of trying to pause once the byte cache runs low. Instead, do something similar wit the demuxer cache. The nice thing is that we can guess how many seconds of video it has cached, and we can make better decisions. But for now, apply a relatively naive heuristic: if the cache is below 0.5 secs, pause, and wait until at least 2 secs are available. Note that due to timestamp reordering, the estimated cached duration of video might be inaccurate, depending on the file format. If the file format has DTS, it's easy, otherwise the duration will seemingly jump back and forth.
Diffstat (limited to 'options')
-rw-r--r--options/m_config.c2
-rw-r--r--options/options.c10
-rw-r--r--options/options.h5
3 files changed, 10 insertions, 7 deletions
diff --git a/options/m_config.c b/options/m_config.c
index d8a5cceccb..479c2e952b 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -974,5 +974,7 @@ static const char *const replaced_opts =
"|status-msg#--term-status-msg"
"|idx#--index"
"|forceidx#--index"
+ "|cache-pause-below#for 'no', use --no-cache-pause"
+ "|no-cache-pause-below#--no-cache-pause"
"|"
;
diff --git a/options/options.c b/options/options.c
index 2ff524f522..a77568858d 100644
--- a/options/options.c
+++ b/options/options.c
@@ -144,9 +144,6 @@ const m_option_t mp_opts[] = {
OPT_INTRANGE("cache-seek-min", stream_cache.seek_min, 0, 0, 0x7fffffff),
OPT_STRING("cache-file", stream_cache.file, 0),
OPT_INTRANGE("cache-file-size", stream_cache.file_max, 0, 0, 0x7fffffff),
- OPT_CHOICE_OR_INT("cache-pause-below", stream_cache_pause, 0, 0, 0x7fffffff,
- ({"no", 0})),
- OPT_INTRANGE("cache-pause-restart", stream_cache_unpause, 0, 0, 0x7fffffff),
#if HAVE_DVDREAD || HAVE_DVDNAV
OPT_STRING("dvd-device", dvd_device, 0),
@@ -220,6 +217,9 @@ const m_option_t mp_opts[] = {
OPT_INTRANGE("demuxer-readahead-packets", demuxer_min_packs, 0, 0, MAX_PACKS),
OPT_INTRANGE("demuxer-readahead-bytes", demuxer_min_bytes, 0, 0, MAX_PACK_BYTES),
+ OPT_DOUBLE("cache-secs", demuxer_min_secs_cache, M_OPT_MIN, .min = 0),
+ OPT_FLAG("cache-pause", cache_pausing, 0),
+
OPT_DOUBLE("mf-fps", mf_fps, 0),
OPT_STRING("mf-type", mf_type, 0),
#if HAVE_TV
@@ -598,13 +598,13 @@ const struct MPOpts mp_default_opts = {
.seek_min = 500,
.file_max = 1024 * 1024,
},
- .stream_cache_pause = 50,
- .stream_cache_unpause = 100,
.demuxer_thread = 1,
.demuxer_min_packs = 0,
.demuxer_min_bytes = 0,
.demuxer_min_secs = 0.2,
.network_rtsp_transport = 2,
+ .demuxer_min_secs_cache = 10,
+ .cache_pausing = 1,
.chapterrange = {-1, -1},
.edition_id = -1,
.default_max_pts_correction = -1,
diff --git a/options/options.h b/options/options.h
index e5436383ad..4468d2abbd 100644
--- a/options/options.h
+++ b/options/options.h
@@ -123,8 +123,6 @@ typedef struct MPOpts {
int use_filedir_conf;
int network_rtsp_transport;
struct mp_cache_opts stream_cache;
- int stream_cache_pause;
- int stream_cache_unpause;
int chapterrange[2];
int edition_id;
int correct_pts;
@@ -189,6 +187,9 @@ typedef struct MPOpts {
char *sub_demuxer_name;
int mkv_subtitle_preroll;
+ double demuxer_min_secs_cache;
+ int cache_pausing;
+
struct image_writer_opts *screenshot_image_opts;
char *screenshot_template;