From f04cb7bf483616f8942b27e1237ea51ecc99e08b Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 19 Feb 2016 20:00:54 +0100 Subject: dxva2: fix autoprobing Doing --hwdec=auto ends up picking dxva2, creating a decoder, and then sending D3D frames down the video chain, which immediately fails and falls back to software. Consider dxva2 only if the VO provides a context. If this fails, autoprobing will proceed to try dxva2-copy as usual. Fixes #2844. --- video/decode/dxva2.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/video/decode/dxva2.c b/video/decode/dxva2.c index 4cc1dcf630..d4ce0c72b3 100644 --- a/video/decode/dxva2.c +++ b/video/decode/dxva2.c @@ -626,7 +626,12 @@ static int dxva2_init_decoder(struct lavc_ctx *s, int w, int h) static int probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info, const char *decoder) { - hwdec_request_api(info, "dxva2"); // we can do without too + hwdec_request_api(info, "dxva2"); + // dxva2-copy can do without external context; dxva2 requires it. + if (hwdec->type != HWDEC_DXVA2_COPY) { + if (!info || !info->hwctx || !info->hwctx->d3d_ctx) + return HWDEC_ERR_NO_CTX; + } for (int i = 0; dxva2_modes[i].guid; i++) { const dxva2_mode *mode = &dxva2_modes[i]; if (mp_codec_to_av_codec_id(decoder) == mode->codec) -- cgit v1.2.3