contrib:ffmpeg: fix crash in DVXA in interlaced VC-1
authorSteve Lhomme <robUx4@videolabs.io>
Tue, 19 Dec 2017 13:51:26 +0000 (14:51 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 20 Dec 2017 16:18:17 +0000 (17:18 +0100)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
contrib/src/ffmpeg/dxva_vc1_crash.patch [new file with mode: 0644]
contrib/src/ffmpeg/rules.mak

diff --git a/contrib/src/ffmpeg/dxva_vc1_crash.patch b/contrib/src/ffmpeg/dxva_vc1_crash.patch
new file mode 100644 (file)
index 0000000..2fecce0
--- /dev/null
@@ -0,0 +1,16 @@
+--- ffmpeg/libavcodec/dxva2_vc1.c      2017-12-19 14:46:36.070857200 +0100
++++ ffmpeg/libavcodec/dxva2_vc1.c.refcrash     2017-12-19 14:36:57.157973200 +0100
+@@ -58,11 +58,11 @@ static void fill_picture_parameters(AVCo
+     memset(pp, 0, sizeof(*pp));
+     pp->wDecodedPictureIndex    =
+     pp->wDeblockedPictureIndex  = ff_dxva2_get_surface_index(avctx, ctx, current_picture->f);
+-    if (s->pict_type != AV_PICTURE_TYPE_I && !v->bi_type)
++    if (s->pict_type != AV_PICTURE_TYPE_I && !v->bi_type && s->last_picture.f->data[0])
+         pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->last_picture.f);
+     else
+         pp->wForwardRefPictureIndex = 0xffff;
+-    if (s->pict_type == AV_PICTURE_TYPE_B && !v->bi_type)
++    if (s->pict_type == AV_PICTURE_TYPE_B && !v->bi_type && s->next_picture.f->data[0])
+         pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(avctx, ctx, s->next_picture.f);
+     else
+         pp->wBackwardRefPictureIndex = 0xffff;
index e99d9df..d88cefd 100644 (file)
@@ -231,6 +231,7 @@ ffmpeg: ffmpeg-$(FFMPEG_BASENAME).tar.xz .sum-ffmpeg
        tar xvJf "$<" --strip-components=1 -C $@-$(FFMPEG_BASENAME)
 ifdef USE_FFMPEG
        $(APPLY) $(SRC)/ffmpeg/armv7_fixup.patch
+       $(APPLY) $(SRC)/ffmpeg/dxva_vc1_crash.patch
 endif
 ifdef USE_LIBAV
        $(APPLY) $(SRC)/ffmpeg/libav_gsm.patch