diff mbox

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

Message ID 20170304003054.17741-1-michael@niedermayer.cc
State Accepted
Headers show

Commit Message

Michael Niedermayer March 4, 2017, 12:30 a.m. UTC
The code previously completely discarded frames that had any error in a slice

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/proresdec2.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Marton Balint March 4, 2017, 2:59 a.m. UTC | #1
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@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@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Michael Niedermayer March 6, 2017, 3:33 p.m. UTC | #2
On Sat, Mar 04, 2017 at 03:59:50AM +0100, Marton Balint wrote:
> 
> 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?

done, applied

thx

[...]
diff mbox

Patch

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,