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

"zhilizhao(赵志立)" quinkblack at foxmail.com
Fri Jun 24 09:58:49 EEST 2022



> On Jun 24, 2022, at 1:59 PM, Steven Liu <lq at chinaffmpeg.org> wrote:
> 
> 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 return AVERROR_EXTERNAL when
> AudioConverterFillComplexBuffer failed.
> BTW change the error message log level from warning to error.
> 
> Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
> ---
> libavcodec/audiotoolboxenc.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/audiotoolboxenc.c b/libavcodec/audiotoolboxenc.c
> index f8305ab89b..00293154bf 100644
> --- a/libavcodec/audiotoolboxenc.c
> +++ b/libavcodec/audiotoolboxenc.c
> @@ -554,11 +554,13 @@ 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);
> +        av_log(avctx, AV_LOG_ERROR, "Encode error: %i\n", ret);
> +        ret = AVERROR_EXTERNAL;
>     }
> 
> -    return 0;
> +    return ret;
> }
> 

LGTM.

> static av_cold void ffat_encode_flush(AVCodecContext *avctx)
> -- 
> 2.25.0
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-devel mailing list