[FFmpeg-devel] [PATCH 1/4] avcodec: move avcodec_flush_buffers from decode.c to utils.c

Anton Khirnov anton at khirnov.net
Tue Mar 10 21:08:17 EET 2020


Quoting James Almer (2020-03-10 19:14:47)
> On 3/10/2020 3:03 PM, Anton Khirnov wrote:
> > Quoting James Almer (2020-02-27 19:01:59)
> >> It's not a decoding exclusive function.
> > 
> > How come? The doxy for it says
> > 'Reset the internal decoder state / flush internal buffers.'
> 
> It touches some fields used by encode.c, like draining and
> buffer_pkt_valid (the latter which admittedly will be gone after this
> patchset, but replaced by others),

draining is for decoders too I think

> and there's at least one encoder implementing an AVCodec.flush()
> callback.
> 
> And doesn't the slash in that doxy imply one or the other?

Hmm, apparently I wrote that doxy and have no recollection of it :)
I think it was supposed to be decoding only.

I see two encoders implementing flush: audiotoolbox and nvenc. The
addition to nvenc was explicit, but not even a year old, audiotoolbox
might or might not have been deliberate.

So it seems pretty unclear to me. I would say calling it on an encoder
is invalid and undefined, but apparently people are doing that and it
sort of sometimes works.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list