aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorthexai <58434170+thexai@users.noreply.github.com>2023-11-04 08:43:12 +0100
committerfritsch <Peter.Fruehberger@gmail.com>2023-11-11 13:21:19 +0100
commit58b5d93f49045fc6c36147b999b32f427b01bcc0 (patch)
treed1ffdf37be0442a614282d839699be8b81a52a05 /tools
parent031dca9bd69d4e4fa2826690e23eea884b7e3a05 (diff)
Fix crash due nullptr surface using DXVA2
This may happen when a stream starts with non I frame.
Diffstat (limited to 'tools')
-rw-r--r--tools/buildsteps/windows/patches/0005-ffmpeg-windows-dxva2-check-nullptr-surface.patch12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/buildsteps/windows/patches/0005-ffmpeg-windows-dxva2-check-nullptr-surface.patch b/tools/buildsteps/windows/patches/0005-ffmpeg-windows-dxva2-check-nullptr-surface.patch
new file mode 100644
index 0000000000..b3e572859b
--- /dev/null
+++ b/tools/buildsteps/windows/patches/0005-ffmpeg-windows-dxva2-check-nullptr-surface.patch
@@ -0,0 +1,12 @@
+diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
+--- a/libavcodec/dxva2.c
++++ b/libavcodec/dxva2.c
+@@ -777,7 +777,7 @@ unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx,
+ #if CONFIG_D3D11VA
+ if (avctx->pix_fmt == AV_PIX_FMT_D3D11)
+ return (intptr_t)frame->data[1];
+- if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
++ if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD && surface) {
+ D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
+ ID3D11VideoDecoderOutputView_GetDesc((ID3D11VideoDecoderOutputView*) surface, &viewDesc);
+ return viewDesc.Texture2D.ArraySlice;