On 27 February 2015 at 05:12, Janne Grunau <[email protected]> wrote:

> On 2015-02-27 04:36:41 +0530, Himangi Saraogi wrote:
> > ---
> >  libavcodec/libx264.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
> > index 6388b6c..71c38cc 100644
> > --- a/libavcodec/libx264.c
> > +++ b/libavcodec/libx264.c
> > @@ -235,11 +235,11 @@ static int X264_frame(AVCodecContext *ctx,
> AVPacket *pkt, const AVFrame *frame,
> >      }
> >      do {
> >          if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic:
> NULL, &pic_out) < 0)
> > -            return -1;
> > +            return AVERROR_UNKNOWN;
> >
> >          ret = encode_nals(ctx, pkt, nal, nnal);
> >          if (ret < 0)
> > -            return -1;
> > +            return ret;
> >      } while (!ret && !frame && x264_encoder_delayed_frames(x4->enc));
> >
> >      pkt->pts = pic_out.i_pts;
> > @@ -518,7 +518,7 @@ static av_cold int X264_init(AVCodecContext *avctx)
> >
> >      x4->enc = x264_encoder_open(&x4->params);
> >      if (!x4->enc)
> > -        return -1;
> > +        return AVERROR_INVALIDDATA;
>
> I think AVERROR_UNKNOWN or EINVAL is a better match here, I'd guess it's
> mostly likely that one of the paramters is invalid. On the otherhand
> that's just guessing and it could be anything but libx264 doesn't tell
> us so UNKNOWN would be valid choice too.
>
>
In libavcodec/libx265.c, we have:

    ctx->encoder = x265_encoder_open(ctx->params);
    if (!ctx->encoder) {
        av_log(avctx, AV_LOG_ERROR, "Cannot open libx265 encoder.\n");
        libx265_encode_close(avctx);
        return AVERROR_INVALIDDATA;
    }
I agree that UNKNOWN is a  valid choice, but think that having uniformity
is a good idea.


> Janne
> _______________________________________________
> libav-devel mailing list
> [email protected]
> https://lists.libav.org/mailman/listinfo/libav-devel
>
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to