On 2013-03-04 11:35:24 +0100, Anton Khirnov wrote:
> ---
>  libavcodec/vc1dec.c |   27 +++++++++++++--------------
>  1 file changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
> index 17d0e16..ea882d6 100644
> --- a/libavcodec/vc1dec.c
> +++ b/libavcodec/vc1dec.c
> @@ -5023,12 +5023,8 @@ static int vc1_decode_sprites(VC1Context *v, 
> GetBitContext* gb)
>          v->two_sprites = 0;
>      }
>  
> -    if (v->sprite_output_frame.data[0])
> -        avctx->release_buffer(avctx, &v->sprite_output_frame);
> -
> -    v->sprite_output_frame.buffer_hints = FF_BUFFER_HINTS_VALID;
> -    v->sprite_output_frame.reference = 0;
> -    if (ff_get_buffer(avctx, &v->sprite_output_frame) < 0) {
> +    av_frame_unref(&v->sprite_output_frame);
> +    if (ff_get_buffer(avctx, &v->sprite_output_frame, 0) < 0) {

not that you've changed anything about it but I'm a little confused how
this works together with the special cases in
mpegvideo.c:alloc_frame_buffer()

>          av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
>          return -1;
>      }
> @@ -5278,9 +5274,8 @@ av_cold int ff_vc1_decode_end(AVCodecContext *avctx)
>      VC1Context *v = avctx->priv_data;
>      int i;
>  
> -    if ((avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == 
> AV_CODEC_ID_VC1IMAGE)
> -        && v->sprite_output_frame.data[0])
> -        avctx->release_buffer(avctx, &v->sprite_output_frame);
> +    av_frame_unref(&v->sprite_output_frame);
> +
>      for (i = 0; i < 4; i++)
>          av_freep(&v->sr_rows[i >> 1][i & 1]);
>      av_freep(&v->hrd_rate);
> @@ -5314,7 +5309,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void 
> *data,
>                              int *got_frame, AVPacket *avpkt)
>  {
>      const uint8_t *buf = avpkt->data;
> -    int buf_size = avpkt->size, n_slices = 0, i;
> +    int buf_size = avpkt->size, n_slices = 0, i, ret;
>      VC1Context *v = avctx->priv_data;
>      MpegEncContext *s = &v->s;
>      AVFrame *pict = data;
> @@ -5331,7 +5326,8 @@ static int vc1_decode_frame(AVCodecContext *avctx, void 
> *data,
>      if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == 
> VC1_CODE_ENDOFSEQ)) {
>          /* special case for last picture */
>          if (s->low_delay == 0 && s->next_picture_ptr) {
> -            *pict = s->next_picture_ptr->f;
> +            if ((ret = av_frame_ref(pict, &s->next_picture_ptr->f)) < 0)
> +                return ret;
>              s->next_picture_ptr = NULL;
>  
>              *got_frame = 1;
> @@ -5649,14 +5645,17 @@ image:
>          if (vc1_decode_sprites(v, &s->gb))
>              goto err;
>  #endif
> -        *pict      = v->sprite_output_frame;
> +        if ((ret = av_frame_ref(pict, &v->sprite_output_frame)) < 0)
> +            goto err;
>          *got_frame = 1;
>      } else {
>          if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
> -            *pict = s->current_picture_ptr->f;
> +            if ((ret = av_frame_ref(pict, &s->current_picture_ptr->f)) < 0)
> +                goto err;
>              ff_print_debug_info(s, s->current_picture_ptr);
>          } else if (s->last_picture_ptr != NULL) {
> -            *pict = s->last_picture_ptr->f;
> +            if ((ret = av_frame_ref(pict, &s->last_picture_ptr->f)) < 0)
> +                goto err;
>              ff_print_debug_info(s, s->last_picture_ptr);
>          }
>          if (s->last_picture_ptr || s->low_delay) {

patch ok

Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to