[FFmpeg-devel] [PATCH 20/42] avcodec/nvdec: Use RefStruct-pool API for decoder pool

Anton Khirnov anton at khirnov.net
Wed Oct 4 17:28:32 EEST 2023


Quoting Andreas Rheinhardt (2023-09-19 21:57:12)
> It involves less allocations, in particular no allocations
> after the entry has been created. Therefore creating a new
> reference from an existing one can't fail and therefore
> need not be checked. It also avoids indirections and casts.
> 
> Also note that nvdec_decoder_frame_init() (the callback
> to initialize new entries from the pool) does not use
> atomics to read and replace the number of entries
> currently used by the pool. This relies on nvdec (like
> most other hwaccels) not being run in a truely frame-threaded
> way.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
> Notice that the AVBufferPool API serializes creating new entries
> as well as getting an already existing entry from the pool,
> so not using atomics here would be fine for it even if nvdec
> were run in a truely multithreaded way.

AFAIK the API does not allow it, so there's nothing we can do about it.

Patch LGTM

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list