Commit 59b126f9 authored by Humberto Ribeiro's avatar Humberto Ribeiro Committed by wm4

libavutil/hwcontext_dxva2: Add check for possible errors from GetAdapterDisplayModeEx

This prevents a possible crash in CreateDeviceEx when using faulty
response from GetAdapterDisplayModeEx and allows ffmpeg to fallback to
classic d3d9.
Signed-off-by: 's avatarwm4 <nfxjfg@googlemail.com>
parent 1b283c4a
...@@ -485,7 +485,11 @@ static int dxva2_device_create9ex(AVHWDeviceContext *ctx, UINT adapter) ...@@ -485,7 +485,11 @@ static int dxva2_device_create9ex(AVHWDeviceContext *ctx, UINT adapter)
if (FAILED(hr)) if (FAILED(hr))
return AVERROR_UNKNOWN; return AVERROR_UNKNOWN;
IDirect3D9Ex_GetAdapterDisplayModeEx(d3d9ex, adapter, &modeex, NULL); hr = IDirect3D9Ex_GetAdapterDisplayModeEx(d3d9ex, adapter, &modeex, NULL);
if (FAILED(hr)) {
IDirect3D9Ex_Release(d3d9ex);
return AVERROR_UNKNOWN;
}
d3dpp.BackBufferFormat = modeex.Format; d3dpp.BackBufferFormat = modeex.Format;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment