[FFmpeg-devel] [PATCH 1/2] doc/examples/transcode_aac: Don't ignore last encoded frame

Paul B Mahol onemda at gmail.com
Wed Mar 2 16:07:25 EET 2022


On Wed, Mar 2, 2022 at 1:53 PM Andreas Unterweger <dustsigns at gmail.com>
wrote:

> > On 02.03.2022 13:27 Paul B Mahol <onemda at gmail.com> wrote:
> >
> >
> > On Wed, Mar 2, 2022 at 1:18 PM Andreas Unterweger <dustsigns at gmail.com>
> > wrote:
> >
> > > > On 02.03.2022 12:55 Paul B Mahol <onemda at gmail.com> wrote:
> > > > > >               do {
> > > > > > -                data_written = 0;
> > > > >
> > > >
> > > > why this is removed ?
> > > >
> > > >
> > > > > >                   if (encode_audio_frame(NULL,
> output_format_context,
> > > > > >                                          output_codec_context,
> > > > > &data_written))
> > > > > >                       goto cleanup;
> > >
> > > It is removed because the function encode_audio_frame (next line)
> > > already sets data_written as an output value (this is also in the
> > > documentation of this function). It is thus not needed to initialize
> > > data_written a second time outside of the function.
> > >
> >
> > Note that it does not set it immediately at start, but later, and upon
> > error it is left untouched/uninitialized.
> >
>
> In case of an error, an error code is returned from the function and
> the output value has no meaning. In the calling function, the cleanup
> is invoked and data_written is not used (as it would make no sense to
> use it in case of an error, anyway).
>
> This behavior is the same as with the decode_audio_frame function. The
> only difference is that the finished = 0 initialization in line 830 is
> needed to avoid to forcefully flush the decoder in lines 865ff on an
> empty input file.
>

The patch on patchwork looks fine.



> _______________________________________________
> 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