[FFmpeg-devel] [PATCH] avcodec/audiotoolboxenc: return error value if encode failed

Steven Liu lq at chinaffmpeg.org
Fri Jun 24 06:02:17 EEST 2022


because the AudioConverterFillComplexBuffer can return 0 or 1 if
success.
so set the ret to 0 it AudioConverterFillComplexBuffer success and
return ret value for success or failed.

Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
 libavcodec/audiotoolboxenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/audiotoolboxenc.c b/libavcodec/audiotoolboxenc.c
index f8305ab89b..50369f4f00 100644
--- a/libavcodec/audiotoolboxenc.c
+++ b/libavcodec/audiotoolboxenc.c
@@ -554,11 +554,12 @@ static int ffat_encode(AVCodecContext *avctx, AVPacket *avpkt,
                                      avctx->frame_size,
                            &avpkt->pts,
                            &avpkt->duration);
+        ret = 0;
     } else if (ret && ret != 1) {
         av_log(avctx, AV_LOG_WARNING, "Encode error: %i\n", ret);
     }
 
-    return 0;
+    return ret;
 }
 
 static av_cold void ffat_encode_flush(AVCodecContext *avctx)
-- 
2.25.0



More information about the ffmpeg-devel mailing list