[vlc-commits] [Git][videolan/vlc][master] ffmpeg: fix DXVA2/D3D11 crash on bogus references

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun Mar 27 15:45:31 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
1e0b78a9 by Steve Lhomme at 2022-03-27T14:47:45+00:00
ffmpeg: fix DXVA2/D3D11 crash on bogus references

Fixes #26738

- - - - -


2 changed files:

- + contrib/src/ffmpeg/0001-dxva2_hevc-don-t-use-frames-as-reference-if-they-are.patch
- contrib/src/ffmpeg/rules.mak


Changes:

=====================================
contrib/src/ffmpeg/0001-dxva2_hevc-don-t-use-frames-as-reference-if-they-are.patch
=====================================
@@ -0,0 +1,34 @@
+From b2e89bd9c548d899ec2fecfc1aa550e9ddfe9777 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 23 Mar 2022 14:52:31 +0100
+Subject: [PATCH] dxva2_hevc: don't use frames as reference if they are not
+ marked as such
+
+Similar to how a frame is considered for referencing for the RefPicList array.
+This will do the same for RefPicSetStCurrBefore, RefPicSetStCurrAfter and
+RefPicSetLtCurr.
+
+Fixes playback of http://www.gbbsoft.pl/!download/!/Film1.mp4
+Ref. VLC issue https://code.videolan.org/videolan/vlc/-/issues/26738
+
+Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
+---
+ libavcodec/dxva2_hevc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c
+index 98b3e74bd7..28c0b26733 100644
+--- a/libavcodec/dxva2_hevc.c
++++ b/libavcodec/dxva2_hevc.c
+@@ -249,7 +249,7 @@ static void fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *
+             const HEVCFrame *frame = NULL; \
+             while (!frame && j < rpl->nb_refs) \
+                 frame = rpl->ref[j++]; \
+-            if (frame) \
++            if (frame && frame->flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF)) \
+                 pp->ref_list[i] = get_refpic_index(pp, ff_dxva2_get_surface_index(avctx, ctx, frame->frame)); \
+             else \
+                 pp->ref_list[i] = 0xff; \
+-- 
+2.27.0.windows.1
+


=====================================
contrib/src/ffmpeg/rules.mak
=====================================
@@ -220,6 +220,7 @@ ffmpeg: ffmpeg-$(FFMPEG_BASENAME).tar.xz .sum-ffmpeg
 	$(APPLY) $(SRC)/ffmpeg/0001-fix-mf_utils-compilation-with-mingw64.patch
 	$(APPLY) $(SRC)/ffmpeg/0001-avcodec-vp9-Do-not-destroy-uninitialized-mutexes-con.patch
 	$(APPLY) $(SRC)/ffmpeg/0001-ffmpeg-add-target_os-support-for-emscripten.patch
+	$(APPLY) $(SRC)/ffmpeg/0001-dxva2_hevc-don-t-use-frames-as-reference-if-they-are.patch
 	$(MOVE)
 
 .ffmpeg: ffmpeg



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1e0b78a970afaabf6af236457cc363d458819787

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1e0b78a970afaabf6af236457cc363d458819787
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list