[FFmpeg-devel] [PATCH] avcodec/encode: change the assert0 from (ret <= 0) to (ret >= 0)

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Jun 28 14:52:39 EEST 2022


Steven Liu:
> Because the codec->cb.encode return 0 is successed,
> and the negative error code should failed.
> 
> Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
> ---
>  libavcodec/encode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/encode.c b/libavcodec/encode.c
> index b68bf1e184..b43a16f708 100644
> --- a/libavcodec/encode.c
> +++ b/libavcodec/encode.c
> @@ -217,7 +217,7 @@ static int encode_simple_internal(AVCodecContext *avctx, AVPacket *avpkt)
>              avpkt->pts = avpkt->dts = frame->pts;
>      }
>  
> -    av_assert0(ret <= 0);
> +    av_assert0(ret >= 0);
>  
>      emms_c();
>  

You are asserting that encoding succeeds (and you allow encoders to
return values > 0, which this check is meant to preclude). This is just
wrong.

- Andreas


More information about the ffmpeg-devel mailing list