diff mbox series

[FFmpeg-devel,18/39] avcodec/libxavs: Improve returned error codes

Message ID HE1PR0301MB2154B4FB1F39AD5CBB8787598F299@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Headers show
Series [FFmpeg-devel,01/39] avcodec/audiotoolboxenc: Remove AV_CODEC_CAP_DR1 | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt May 21, 2021, 9:17 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/libxavs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/libxavs.c b/libavcodec/libxavs.c
index ea53c49d38..88f674de40 100644
--- a/libavcodec/libxavs.c
+++ b/libavcodec/libxavs.c
@@ -112,7 +112,7 @@  static int encode_nals(AVCodecContext *ctx, AVPacket *pkt,
         int size = p_end - p;
         s = xavs_nal_encode(p, &size, 1, nals + i);
         if (s < 0)
-            return -1;
+            return AVERROR_EXTERNAL;
         if (s != 3U + nals[i].i_payload)
             return AVERROR_BUG;
         p += s;
@@ -146,12 +146,12 @@  static int XAVS_frame(AVCodecContext *avctx, AVPacket *pkt,
 
     if (xavs_encoder_encode(x4->enc, &nal, &nnal,
                             frame? &x4->pic: NULL, &pic_out) < 0)
-    return -1;
+        return AVERROR_EXTERNAL;
 
     ret = encode_nals(avctx, pkt, nal, nnal);
 
     if (ret < 0)
-        return -1;
+        return ret;
 
     if (!ret) {
         if (!frame && !(x4->end_of_stream)) {
@@ -345,7 +345,7 @@  static av_cold int XAVS_init(AVCodecContext *avctx)
 
     x4->enc = xavs_encoder_open(&x4->params);
     if (!x4->enc)
-        return -1;
+        return AVERROR_EXTERNAL;
 
     if (!(x4->pts_buffer = av_mallocz_array((avctx->max_b_frames+1), sizeof(*x4->pts_buffer))))
         return AVERROR(ENOMEM);