From 45e45a606077ccd0aab7eaffb8697e633b876fb2 Mon Sep 17 00:00:00 2001 From: James Almer Date: Fri, 14 Jan 2022 22:09:20 -0300 Subject: [PATCH] avcodec/libmp3lame: return proper error codes Signed-off-by: James Almer --- libavcodec/libmp3lame.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index 5675864bb2..e8082fade3 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -138,7 +138,7 @@ static av_cold int mp3lame_encode_init(AVCodecContext *avctx) /* set specified parameters */ if (lame_init_params(s->gfp) < 0) { - ret = -1; + ret = AVERROR_EXTERNAL; goto error; } @@ -231,7 +231,7 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, "lame: output buffer too small (buffer index: %d, free bytes: %d)\n", s->buffer_index, s->buffer_size - s->buffer_index); } - return -1; + return AVERROR(ENOMEM); } s->buffer_index += lame_result; ret = realloc_buffer(s); @@ -259,7 +259,7 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, return AVERROR_BUG; } else if (ret) { av_log(avctx, AV_LOG_ERROR, "free format output not supported\n"); - return -1; + return AVERROR_INVALIDDATA; } len = hdr.frame_size; ff_dlog(avctx, "in:%d packet-len:%d index:%d\n", avctx->frame_size, len,