We should return 0 and assert there's something wrong. This is how it's done
with the other DXVA variants.

It fixes bad reference usage in http://www.gbbsoft.pl/!download/!/Film1.mp4
It's using a frame that doesn't have any data[] fields set (yet?).

Signed-off-by: Steve Lhomme <rob...@ycbcr.xyz>
---
 libavcodec/dxva2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index 568d686f39..043497b74f 100644
--- 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;
-- 
2.29.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to