mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-28 23:13:18 +08:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user