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 <[email protected]> > --- [...]
> 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*()
[...]
--
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
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list [email protected] http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
