From patchwork Wed Mar 23 12:16:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Lhomme X-Patchwork-Id: 34933 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:ab0:5fda:0:0:0:0:0 with SMTP id g26csp873388uaj; Wed, 23 Mar 2022 05:16:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybMpAcGnuiHeUUdcqAHXMOfn+rx9t/xnzYzBMHDkqofrAu5AVsZMyhHetJB+9toFkCc3sV X-Received: by 2002:a17:907:2ce3:b0:6df:d80f:ca1 with SMTP id hz3-20020a1709072ce300b006dfd80f0ca1mr21107779ejc.61.1648037808866; Wed, 23 Mar 2022 05:16:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648037808; cv=none; d=google.com; s=arc-20160816; b=dLBWeGQEvln9lhxb8+i6TX720U1JG6uyFn2vVWOrkqv75Zghi4YLALm5xAfmRdC+xv cFhUQ89LBgbYCeOlDP8JkWaVMhRrKBT19o6l8g/97KKLzAVg4HWM6cAFBAYsWzpaSsPp 6fjt+TGdFge8d0fBd+fxWm39ulNJj1pczYxjpLHDEWFJRwtItlHIvx8/bjlaBhB9QKxQ tWNCV59BMaO1r6vcaEInXRyRrJ9UEgdkv9ByOZbnhSp6sVb0IIl5X0Lg13LEY4E2VP8A qUSp0BhsPBIpdUUMGb+q0hIJcfnbOr8hRI657UtWRykWoVNUIjeEpe4k2clXCm+0ZiHQ NRpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=QGhz+rUsvOPEj6XSMHy/63d5aQRQ3W7vdAYYYdJ5zhY=; b=A3GkVQa2kdh31SBjfw1MnZZ7klRf+zWMifDE1fjyrrXK+nS/aLSPLo0PR7ewsgCIn8 kl/gl8iVpbhWTctLor5T7Zm12X9pmUhX7GVtdFompPAxt/NyIC36K2p8i8OGNqOcloP1 x/hxqFd6WJcpR2PN1GCYcqmAzvD0aF0FbrZ0JF5sq4jIpjWOE6WMMWxwwhiPgKmT1SSd w4tCVX3NCiOb+aHUE6vmWBjQKtXSPBd2+ACsg8poWRgGoDtqtz1YDHbzsYVy2u0ovYt5 PW1a0SpoDpJgpbVsBDrGWEjKE/2B+bnybJGRg0s+oRKL8svbbZV/6rm61v9YMo2D1C2w 5v0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b25-20020a50ccd9000000b00418c2b5bf45si14868039edj.551.2022.03.23.05.16.48; Wed, 23 Mar 2022 05:16:48 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EB52968A8A5; Wed, 23 Mar 2022 14:16:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B2F5B68A8A5 for ; Wed, 23 Mar 2022 14:16:37 +0200 (EET) Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:105:465:1:3:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4KNnQX4gNNz9sYd for ; Wed, 23 Mar 2022 13:16:36 +0100 (CET) From: Steve Lhomme To: ffmpeg-devel@ffmpeg.org Date: Wed, 23 Mar 2022 13:16:21 +0100 Message-Id: <20220323121621.7615-1-robux4@ycbcr.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/dxva2: don't call GetDesc on a NULL ID3D11VideoDecoderOutputView X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: MV+ExPT+gBnw 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 --- 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;