[FFmpeg-devel] [PATCH] avcodec/proresdec2: Do not discard frames with bad slices

Marton Balint cus at passwd.hu
Sat Mar 4 04:59:50 EET 2017


On Sat, 4 Mar 2017, Michael Niedermayer wrote:

> The code previously completely discarded frames that had any error in a slice

Could you set either AVFrame->flags to AV_FRAME_FLAG_CORRUPT or 
AVFrame->decode_error_flags to FF_DECODE_ERROR_INVALID_BITSTREAM in case 
of error on any of the slices?

Thanks,
Marton

>
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
> libavcodec/proresdec2.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
> index a3a1ebdecb..75fba9d35d 100644
> --- a/libavcodec/proresdec2.c
> +++ b/libavcodec/proresdec2.c
> @@ -618,10 +618,11 @@ static int decode_picture(AVCodecContext *avctx)
>     avctx->execute2(avctx, decode_slice_thread, NULL, NULL, ctx->slice_count);
>
>     for (i = 0; i < ctx->slice_count; i++)
> -        if (ctx->slices[i].ret < 0)
> -            return ctx->slices[i].ret;
> +        if (ctx->slices[i].ret >= 0)
> +            return 0;
> 
> -    return 0;
> +    av_assert0(ctx->slice_count>0);
> +    return ctx->slices[0].ret;
> }
> 
> static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
> -- 
> 2.11.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list