summaryrefslogtreecommitdiffstats
path: root/video/decode
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2023-01-21 15:45:11 +0100
committerNiklas Haas <github-daiK1o@haasn.dev>2023-01-23 14:13:34 +0100
commitc7ea0cd68f2cd68edea2f64060c1bcb483005a50 (patch)
tree7d52e83db2da101d36fa19884f9c0cf1740e9651 /video/decode
parentf8c17f55f975ea3b46ba7cea299f1a8e5d980b4c (diff)
downloadmpv-c7ea0cd68f2cd68edea2f64060c1bcb483005a50.tar.bz2
mpv-c7ea0cd68f2cd68edea2f64060c1bcb483005a50.tar.xz
vd_lavc: add "auto" choice for vd-lavc-dr
--vd-lavc-dr defaulted to "yes", which caused issues on certain hardware. Instead of disabling it, add a new "auto" value and make it the default. The "auto" choice will enable DR only when we can request host-cached buffers (as signalled by the new VO_DR_FLAG_HOST_CACHED). Co-authored-by: Nicolas F. <ovdev@fratti.ch> Co-authored-by: Niklas Haas <git@haasn.dev>
Diffstat (limited to 'video/decode')
-rw-r--r--video/decode/vd_lavc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 86f872973f..52ee6881bc 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -120,7 +120,8 @@ const struct m_sub_options vd_lavc_conf = {
{"vd-lavc-software-fallback", OPT_CHOICE(software_fallback,
{"no", INT_MAX}, {"yes", 1}), M_RANGE(1, INT_MAX)},
{"vd-lavc-o", OPT_KEYVALUELIST(avopts)},
- {"vd-lavc-dr", OPT_FLAG(dr)},
+ {"vd-lavc-dr", OPT_CHOICE(dr,
+ {"auto", -1}, {"no", 0}, {"yes", 1})},
{"hwdec", OPT_STRING(hwdec_api),
.help = hwdec_opt_help,
.flags = M_OPT_OPTIONAL_PARAM | UPDATE_HWDEC},
@@ -139,7 +140,7 @@ const struct m_sub_options vd_lavc_conf = {
.skip_idct = AVDISCARD_DEFAULT,
.skip_frame = AVDISCARD_DEFAULT,
.framedrop = AVDISCARD_NONREF,
- .dr = 1,
+ .dr = -1,
.hwdec_api = "no",
.hwdec_codecs = "h264,vc1,hevc,vp8,vp9,av1,prores",
// Maximum number of surfaces the player wants to buffer. This number
@@ -984,8 +985,10 @@ static int get_buffer2_direct(AVCodecContext *avctx, AVFrame *pic, int flags)
struct mp_image *img = mp_image_pool_get_no_alloc(p->dr_pool, imgfmt, w, h);
if (!img) {
- MP_DBG(p, "Allocating new DR image...\n");
- img = vo_get_image(p->vo, imgfmt, w, h, stride_align, 0);
+ bool host_cached = p->opts->dr == -1; // auto
+ int dr_flags = host_cached ? VO_DR_FLAG_HOST_CACHED : 0;
+ MP_DBG(p, "Allocating new%s DR image...\n", host_cached ? " (host-cached)" : "");
+ img = vo_get_image(p->vo, imgfmt, w, h, stride_align, dr_flags);
if (!img) {
MP_DBG(p, "...failed..\n");
goto fallback;