[FFmpeg-devel] [PATCH V3 2/2] hwaccel_mpeg: check reference pictures are available

Li, Zhong zhong.li at intel.com
Fri Oct 13 08:24:09 EEST 2017


> -----Original Message-----
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf
> Of Michael Niedermayer
> Sent: Friday, October 13, 2017 4:21 AM
> To: FFmpeg development discussions and patches
> <ffmpeg-devel at ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH V3 2/2] hwaccel_mpeg: check reference
> pictures are available
> 
> On Thu, Oct 12, 2017 at 04:20:45PM +0800, Zhong Li wrote:
> > some reference pictures are not existed but valiad surface_ids are
> > set, (for example, the second field of the first key frame can be
> > P_Picture_Type but there is no preivous frame.) then may cause some
> > driver problems (e.g, segment fault on  mesa/AMD driver).
> >
> > Signed-off-by: Zhong Li <zhong.li at intel.com>
> > ---
> [...]
> 
> > diff --git a/libavcodec/vdpau_mpeg12.c b/libavcodec/vdpau_mpeg12.c
> > index b657007ee7..6d73d45f1a 100644
> > --- a/libavcodec/vdpau_mpeg12.c
> > +++ b/libavcodec/vdpau_mpeg12.c
> > @@ -45,13 +45,18 @@ static int
> vdpau_mpeg_start_frame(AVCodecContext
> > *avctx,
> >
> >      switch (s->pict_type) {
> >      case AV_PICTURE_TYPE_B:
> > -        ref = ff_vdpau_get_surface_id(s->next_picture.f);
> > -        assert(ref != VDP_INVALID_HANDLE);
> > -        info->backward_reference = ref;
> > +        if (s->next_picture_ptr) {
> > +            ref = ff_vdpau_get_surface_id(s->next_picture.f);
> > +            assert(ref != VDP_INVALID_HANDLE);
> > +            info->backward_reference = ref;
> > +        }
> >          /* fall through to forward prediction */
> 
> >      case AV_PICTURE_TYPE_P:
> > -        ref = ff_vdpau_get_surface_id(s->last_picture.f);
> > -        info->forward_reference  = ref;
> > +        if (s->last_picture_ptr) {
> > +            ref = ff_vdpau_get_surface_id(s->last_picture.f);
> 
> > +            assert(ref != VDP_INVALID_HANDLE);
> 
> please use av_assert*()

Ok, will update.
> 
> [...]
> --
> Michael     GnuPG fingerprint:
> 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> When you are offended at any man's fault, turn to yourself and study your
> own failings. Then you will forget your anger. -- Epictetus


More information about the ffmpeg-devel mailing list