diff mbox

[FFmpeg-devel] avcodec/vaapi_h264: skip decode if pic has no slices

Message ID CAMQ1+vyeRY5iiU8RXtXJ355zHk1TsHYK3q=fzKhFtRxXtVHfwA@mail.gmail.com
State Superseded
Headers show

Commit Message

Peter F March 9, 2019, 11:46 a.m. UTC
Fixes / workarounds: https://bugs.freedesktop.org/show_bug.cgi?id=105368
[1]in ffmpeg
This bug hits several AMD VAAPI users, especially those using h264 channels
via DVB-X: https://github.com/xbmc/xbmc/issues/15704

Typical backtrace in ffmpeg code, which fits the description in [1]:

#0  __memset_sse2_unaligned_erms () at
../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S:186
#1  0x00007ff39a9607b4 in ?? () from
/usr/lib/x86_64-linux-gnu/dri/r600_drv_video.so
#2  0x00007ff39a6bf6a1 in ?? () from
/usr/lib/x86_64-linux-gnu/dri/r600_drv_video.so
#3  0x00007ff3d1763820 in vaEndPicture () from
/usr/lib/x86_64-linux-gnu/libva.so.2
#4  0x000055cd92b3655a in ff_vaapi_decode_issue ()
#5  0x000055cd926dc8e1 in ?? ()
#6  0x000055cd92a4975c in ff_h264_field_end ()
#7  0x000055cd92455ca1 in ?? ()
#8  0x000055cd923a3727 in ?? ()
#9  0x000055cd923a6448 in avcodec_send_packet ()
diff mbox

Patch

From 816e9156235a5d7d895b09c0235c9f8f1f7703e7 Mon Sep 17 00:00:00 2001
From: xbmc <fernetmenta@online.de>
Date: Sat, 26 Jan 2019 19:48:35 +0100
Subject: [PATCH] avcodec/vaapi_h264: skip decode if pic has no slices

---
 libavcodec/vaapi_h264.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
index 5854587a25..81a46fa747 100644
--- a/libavcodec/vaapi_h264.c
+++ b/libavcodec/vaapi_h264.c
@@ -317,6 +317,11 @@  static int vaapi_h264_end_frame(AVCodecContext *avctx)
     H264SliceContext *sl = &h->slice_ctx[0];
     int ret;
 
+    if (pic->nb_slices == 0) {
+        ret = -1;
+        goto finish;
+    }
+
     ret = ff_vaapi_decode_issue(avctx, pic);
     if (ret < 0)
         goto finish;
-- 
2.19.1