mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
bddf0efade
commit
61f0797557
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue