summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/vf.rst5
-rw-r--r--video/filter/vf_vapoursynth.c11
2 files changed, 12 insertions, 4 deletions
diff --git a/DOCS/man/vf.rst b/DOCS/man/vf.rst
index e0427bd88d..bc95d0e1c5 100644
--- a/DOCS/man/vf.rst
+++ b/DOCS/man/vf.rst
@@ -753,13 +753,16 @@ Available filters are:
filters work anyway.)
``concurrent-frames``
- Number of frames that should be requested in parallel (default: 2). The
+ Number of frames that should be requested in parallel. The
level of concurrency depends on the filter and how quickly mpv can
decode video to feed the filter. This value should probably be
proportional to the number of cores on your machine. Most time,
making it higher than the number of cores can actually make it
slower.
+ By default, this uses the special value ``auto``, which sets the option
+ to the number of detected logical CPU cores.
+
The following variables are defined by mpv:
``video_in``
diff --git a/video/filter/vf_vapoursynth.c b/video/filter/vf_vapoursynth.c
index 178ebb2bc1..ea5e86d599 100644
--- a/video/filter/vf_vapoursynth.c
+++ b/video/filter/vf_vapoursynth.c
@@ -26,6 +26,7 @@
#include <VSHelper.h>
#include <libavutil/rational.h>
+#include <libavutil/cpu.h>
#include "config.h"
@@ -700,9 +701,12 @@ static int vf_open(vf_instance_t *vf)
vf->query_format = query_format;
vf->control = control;
vf->uninit = uninit;
- int maxbuffer = p->cfg_maxbuffer * p->cfg_maxrequests;
- p->buffered = talloc_array(vf, struct mp_image *, maxbuffer);
p->max_requests = p->cfg_maxrequests;
+ if (p->max_requests < 0)
+ p->max_requests = av_cpu_count();
+ MP_VERBOSE(vf, "using %d concurrent requests.\n", p->max_requests);
+ int maxbuffer = p->cfg_maxbuffer * p->max_requests;
+ p->buffered = talloc_array(vf, struct mp_image *, maxbuffer);
p->requested = talloc_zero_array(vf, struct mp_image *, p->max_requests);
return 1;
}
@@ -711,7 +715,8 @@ static int vf_open(vf_instance_t *vf)
static const m_option_t vf_opts_fields[] = {
OPT_STRING("file", cfg_file, 0),
OPT_INTRANGE("buffered-frames", cfg_maxbuffer, 0, 1, 9999, OPTDEF_INT(4)),
- OPT_INTRANGE("concurrent-frames", cfg_maxrequests, 0, 1, 99, OPTDEF_INT(2)),
+ OPT_CHOICE_OR_INT("concurrent-frames", cfg_maxrequests, 0, 1, 99,
+ ({"auto", -1}), OPTDEF_INT(-1)),
{0}
};