0002-avcodec-vaapi_h264-skip-decode-if-pic-has-no-slices.patch 1.2 KB

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