summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-08-05 23:41:29 +0200
committerwm4 <wm4@nowhere>2015-08-05 23:41:29 +0200
commitbeb4f8316aca2f206ce1ea743498b4241670c37d (patch)
treeda40098d6ea48641c6e3cf375971e2a66488984b /options
parent775d81609627e4c6e091ae3761cdb1235f789276 (diff)
downloadmpv-beb4f8316aca2f206ce1ea743498b4241670c37d.tar.bz2
mpv-beb4f8316aca2f206ce1ea743498b4241670c37d.tar.xz
demux: add options to control maximum queue size
Add --demuxer-max-packets and --demuxer-max-bytes, which control the maximum size of the packet queue. These can be helpful to avoid excessive memory usage. Memory usage is the reason why there's a limit in the first place. If a file is more or less broken, and audio and video don't line up, the decoders will fill up the packet queue trying to read more audio or video, and the maximum sizes are required to avoid unbounded memory allocation. Being able to override the maximum sizes is useful; either for restricting memory usage further, or enlarging the sizes when attempting to play various broken files.
Diffstat (limited to 'options')
-rw-r--r--options/options.c4
-rw-r--r--options/options.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/options/options.c b/options/options.c
index 93f7b4a45e..1528f06ee5 100644
--- a/options/options.c
+++ b/options/options.c
@@ -242,6 +242,8 @@ const m_option_t mp_opts[] = {
OPT_STRING("sub-demuxer", sub_demuxer_name, 0),
OPT_FLAG("demuxer-thread", demuxer_thread, 0),
OPT_DOUBLE("demuxer-readahead-secs", demuxer_min_secs, M_OPT_MIN, .min = 0),
+ OPT_INTRANGE("demuxer-max-packets", demuxer_max_packs, 0, 0, INT_MAX),
+ OPT_INTRANGE("demuxer-max-bytes", demuxer_max_bytes, 0, 0, INT_MAX),
OPT_FLAG("force-seekable", force_seekable, 0),
@@ -718,6 +720,8 @@ const struct MPOpts mp_default_opts = {
.back_buffer = 75000,
.file_max = 1024 * 1024,
},
+ .demuxer_max_packs = 16000,
+ .demuxer_max_bytes = 400 * 1024 * 1024,
.demuxer_thread = 1,
.demuxer_min_secs = 1.0,
.network_rtsp_transport = 2,
diff --git a/options/options.h b/options/options.h
index 677b23f92e..4382831883 100644
--- a/options/options.h
+++ b/options/options.h
@@ -195,6 +195,8 @@ typedef struct MPOpts {
char **audio_files;
char *demuxer_name;
+ int demuxer_max_packs;
+ int demuxer_max_bytes;
int demuxer_thread;
double demuxer_min_secs;
char *audio_demuxer_name;