diff mbox

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

Message ID CAMQ1+vySXZ-xvkVA3x4yY8-yMJ=3FTScQFkssVCz9JSNKcG4kw@mail.gmail.com
State Superseded
Headers show

Commit Message

Peter F March 9, 2019, 3:44 p.m. UTC
Yes, that makes sense. Thank you very much.
Attached you find the updated version.

Am Sa., 9. März 2019 um 16:32 Uhr schrieb Thomas Xu <oddstone@gmail.com>:
>
> should we return AVERROR_INVALIDDATA instead of -1?
> thanks
>
> On Sat, Mar 9, 2019 at 8:25 PM Peter F <peter.fruehberger@gmail.com> wrote:
>
> > 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
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
diff mbox

Patch

From 386c94489a86bb747b6531f727843cf259a24f5d 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..f12fdc457a 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 = AVERROR_INVALIDDATA;
+        goto finish;
+    }
+
     ret = ff_vaapi_decode_issue(avctx, pic);
     if (ret < 0)
         goto finish;
-- 
2.20.1