summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-07-12 18:06:33 -0500
committerDudemanguy <random342@airmail.cc>2023-07-22 17:42:25 +0000
commit61f07975578d70dfbb7ce5ddca8386fa434d3437 (patch)
tree13d9b920f51e06718612ecdb96be54b62b1b601a /video
parentbddf0efade9e08f8a0e3db0fccf535388de13dea (diff)
downloadmpv-61f07975578d70dfbb7ce5ddca8386fa434d3437.tar.bz2
mpv-61f07975578d70dfbb7ce5ddca8386fa434d3437.tar.xz
vd_lavc: respect vd-lavc-software-fallback opt
There's an option that's supposed to stop mpv from falling back to software decoding if hardware decoding fails. Except that it doesn't work and can fallback to software decoding anyway. Correct this by checking if all possible hwdec failed after the loop in select_and_set_hwdec and that we have this option. If so, flag a bool to force eof. In decode_frame afterwards, we then simply immediately return an EOF.
Diffstat (limited to 'video')
-rw-r--r--video/decode/vd_lavc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 77f64aa8c5..1cd8ba4438 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -183,6 +183,7 @@ typedef struct lavc_ctx {
const char *decoder;
bool hwdec_failed;
bool hwdec_notified;
+ bool force_eof;
bool intra_only;
int framedrop_flags;
@@ -589,7 +590,14 @@ static void select_and_set_hwdec(struct mp_filter *vd)
MP_VERBOSE(vd, "Using underlying hw-decoder '%s'\n",
ctx->hwdec.codec->name);
} else {
- MP_VERBOSE(vd, "Using software decoding.\n");
+ // If software fallback is disabled and we get here, all hwdec must
+ // have failed. Tell the ctx to always force an eof.
+ if (ctx->opts->software_fallback == INT_MAX) {
+ MP_WARN(ctx, "Software decoding fallback is disabled.\n");
+ ctx->force_eof = true;
+ } else {
+ MP_VERBOSE(vd, "Using software decoding.\n");
+ }
}
}
@@ -1167,7 +1175,7 @@ static int decode_frame(struct mp_filter *vd)
vd_ffmpeg_ctx *ctx = vd->priv;
AVCodecContext *avctx = ctx->avctx;
- if (!avctx)
+ if (!avctx || ctx->force_eof)
return AVERROR_EOF;
prepare_decoding(vd);