[FFmpeg-cvslog] avcodec/libmp3lame: return proper error codes

James Almer git at videolan.org
Sat Jan 15 03:16:47 EET 2022


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Jan 14 22:09:20 2022 -0300| [45e45a606077ccd0aab7eaffb8697e633b876fb2] | committer: James Almer

avcodec/libmp3lame: return proper error codes

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=45e45a606077ccd0aab7eaffb8697e633b876fb2
---

 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,



More information about the ffmpeg-cvslog mailing list