diff mbox series

[FFmpeg-devel,5/5] avcodec/decode: EAGAIN is not fully supported in decode_simple_internal()

Message ID 20230918223534.23567-5-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/5] tools/target_dec_fuzzer: Adjust wmapro threshold | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Sept. 18, 2023, 10:35 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/decode.c | 1 +
 1 file changed, 1 insertion(+)

Comments

James Almer Sept. 18, 2023, 11:30 p.m. UTC | #1
On 9/18/2023 7:35 PM, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>   libavcodec/decode.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 169ee79acd9..376e4a4d373 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -457,6 +457,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>       if (ret == AVERROR(EAGAIN))
>           av_frame_unref(frame);
>   
> +    av_assert0(consumed != AVERROR(EAGAIN)); // code later will add AVERROR(EAGAIN) to a pointer

FF_CODEC_CB_TYPE_DECODE decoders must not return EAGAIN or EOF, only 
actual error codes. IMO that should be stated too.

>       if (consumed < 0)
>           ret = consumed;
>       if (consumed >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO)

LGTM.
Michael Niedermayer Sept. 19, 2023, 6:24 p.m. UTC | #2
On Mon, Sep 18, 2023 at 08:30:58PM -0300, James Almer wrote:
> On 9/18/2023 7:35 PM, Michael Niedermayer wrote:
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >   libavcodec/decode.c | 1 +
> >   1 file changed, 1 insertion(+)
> > 
> > diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> > index 169ee79acd9..376e4a4d373 100644
> > --- a/libavcodec/decode.c
> > +++ b/libavcodec/decode.c
> > @@ -457,6 +457,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
> >       if (ret == AVERROR(EAGAIN))
> >           av_frame_unref(frame);
> > +    av_assert0(consumed != AVERROR(EAGAIN)); // code later will add AVERROR(EAGAIN) to a pointer
> 
> FF_CODEC_CB_TYPE_DECODE decoders must not return EAGAIN or EOF, only actual
> error codes. IMO that should be stated too.

ok will apply with an expanded comment


> 
> >       if (consumed < 0)
> >           ret = consumed;
> >       if (consumed >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO)
> 
> LGTM.

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 169ee79acd9..376e4a4d373 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -457,6 +457,7 @@  FF_ENABLE_DEPRECATION_WARNINGS
     if (ret == AVERROR(EAGAIN))
         av_frame_unref(frame);
 
+    av_assert0(consumed != AVERROR(EAGAIN)); // code later will add AVERROR(EAGAIN) to a pointer
     if (consumed < 0)
         ret = consumed;
     if (consumed >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO)