1From 2c6b3f357331e203ad87214984661c40704aceb7 Mon Sep 17 00:00:00 2001
2From: Rainer Hochecker <fernetmenta@online.de>
3Date: Sat, 26 Jan 2019 19:48:35 +0100
4Subject: [PATCH] avcodec/vaapi_h264: skip decode if pic has no slices
5
6This fixes / workarounds https://bugs.freedesktop.org/show_bug.cgi?id=105368.
7It was hit frequently when watching h264 channels received via DVB-X.
8Corresponding kodi bug: https://github.com/xbmc/xbmc/issues/15704
9
10Downloaded from Kodi ffmpeg repo:
11https://github.com/xbmc/FFmpeg/commit/2c6b3f357331e203ad87214984661c40704aceb7
12
13Patch was sent upstream:
14http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/240863.html
15
16Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
17---
18 libavcodec/vaapi_h264.c | 5 +++++
19 1 file changed, 5 insertions(+)
20
21diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
22index dd2a6571604..e521a05c4ff 100644
23--- a/libavcodec/vaapi_h264.c
24+++ b/libavcodec/vaapi_h264.c
25@@ -314,6 +314,11 @@ static int vaapi_h264_end_frame(AVCodecContext *avctx)
26     H264SliceContext *sl = &h->slice_ctx[0];
27     int ret;
28
29+    if (pic->nb_slices == 0) {
30+        ret = AVERROR_INVALIDDATA;
31+        goto finish;
32+    }
33+
34     ret = ff_vaapi_decode_issue(avctx, pic);
35     if (ret < 0)
36         goto finish;
37