[FFmpeg-devel] [PATCH 1/2] fftools/ffmpeg: exit application when decoding returns AVERROR_EXIT

Gyan Doshi ffmpeg at gyani.pro
Tue Oct 19 07:20:41 EEST 2021



On 2021-10-19 09:38 am, Soft Works wrote:
>
>> -----Original Message-----
>> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
>> Gyan Doshi
>> Sent: Tuesday, October 19, 2021 6:01 AM
>> To: ffmpeg-devel at ffmpeg.org
>> Subject: Re: [FFmpeg-devel] [PATCH 1/2] fftools/ffmpeg: exit
>> application when decoding returns AVERROR_EXIT
>>
>>
>>
>> On 2021-10-19 04:54 am, Soft Works wrote:
>>> Introduce a way for decoders to request application exit via error
>> return
>>
>> Why? The ffmpeg app may be processing multiple inputs and outputs. At
>> most, you can close the codec and end the stream.
> When a hardware device fails unexpectedly, why should the app continue
> running? In this case, it's clear that things do not work as intended.

Because the application may be doing other things and the hardware 
function may not be central to its task.

See the condition just before the one you added. It is `exit_on_error` 
which implies that the user can *choose* to exit, or not, upon error. 
Your patch lets the decoder unilaterally decide to quit without user input.

In fact, I don't think your patch is necessary. You added the condition 
in process_input_packet() . During decoding, check_decode_result() is 
called, which has

     if (ret < 0 && exit_on_error)
         exit_program(1);

So, the user can choose to set exit_on_error and get this behaviour.

Regards,
Gyan


More information about the ffmpeg-devel mailing list