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

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Oct 5 15:14:16 EEST 2022


Steven Liu:
> "zhilizhao(赵志立)" <quinkblack at foxmail.com> 于2022年8月22日周一 10:49写道:
>>
>>
>>
>>> On Aug 19, 2022, at 11:14 PM, James Almer <jamrial at gmail.com> wrote:
>>>
>>> On 6/24/2022 4:05 AM, Steven Liu wrote:
>>>> "zhilizhao(赵志立)" <quinkblack at foxmail.com> 于2022年6月24日周五 14:59写道:
>>>>>
>>>>>
>>>>>
>>>>>> 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.
>>>> Applied, Thanks
>>>
>>> This is probably the source of the regression described in https://trac.ffmpeg.org/ticket/9866
>>>
>>> Can you look at it?
>>
>> There is a patch which doesn’t get apply yet:
>>
>> http://ffmpeg.org/pipermail/ffmpeg-devel/2022-June/298199.html
> 
> commit as 627543f58a3166810b9cd9c8b483678c82a99be9
>>

You should backport this fix to 5.1. See ticket #9960.

- Andreas



More information about the ffmpeg-devel mailing list