[libav-stable] mpegvideo: set reference/pict_type on generated reference frames

Reinhard Tartler siretart at gmail.com
Sun Jan 5 22:51:57 CET 2014


The patch below doesn't cleanly apply. Can you check if it is
important for release/9, and if so, please backport it?

thanks
Reinhard

On Fri, Jan 3, 2014 at 11:05 AM, Anton Khirnov <git at libav.org> wrote:
> Module: libav
> Branch: master
> Commit: feded990e3ef9af4a0b827d5b6d8fe86f0b94942
>
> Author:    Anton Khirnov <anton at khirnov.net>
> Committer: Anton Khirnov <anton at khirnov.net>
> Date:      Thu Nov 28 10:54:35 2013 +0100
>
> mpegvideo: set reference/pict_type on generated reference frames
>
> Otherwise the generic code will unref them, which can then result in
> last_picture_ptr == current_picture_ptr, which causes deadlocks at least
> in rv40.
>
> Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
> CC:libav-stable at libav.org
>
> ---
>
>  libavcodec/mpegvideo.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
> index f39cdca..f34c81d 100644
> --- a/libavcodec/mpegvideo.c
> +++ b/libavcodec/mpegvideo.c
> @@ -1540,6 +1540,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
>              return i;
>          }
>          s->last_picture_ptr = &s->picture[i];
> +
> +        s->last_picture_ptr->reference   = 3;
> +        s->last_picture_ptr->f.pict_type = AV_PICTURE_TYPE_I;
> +
>          if (ff_alloc_picture(s, s->last_picture_ptr, 0) < 0) {
>              s->last_picture_ptr = NULL;
>              return -1;
> @@ -1567,6 +1571,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
>              return i;
>          }
>          s->next_picture_ptr = &s->picture[i];
> +
> +        s->next_picture_ptr->reference   = 3;
> +        s->next_picture_ptr->f.pict_type = AV_PICTURE_TYPE_I;
> +
>          if (ff_alloc_picture(s, s->next_picture_ptr, 0) < 0) {
>              s->next_picture_ptr = NULL;
>              return -1;
>
> _______________________________________________
> libav-stable mailing list
> libav-stable at libav.org
> https://lists.libav.org/mailman/listinfo/libav-stable



-- 
regards,
    Reinhard


More information about the libav-stable mailing list