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

Steven Liu lingjiujianke at gmail.com
Tue Jun 28 15:07:16 EEST 2022


Andreas Rheinhardt <andreas.rheinhardt at outlook.com> 于2022年6月28日周二 19:52写道:
>
> 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.
Should i only check succeeds !ret?

Thanks
Steven


More information about the ffmpeg-devel mailing list