mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-01-06 06:05:32 +01:00
Very similar to the AVBufferPool API, but with some differences: 1. Reusing an already existing entry does not incur an allocation at all any more (the AVBufferPool API needs to allocate an AVBufferRef). 2. The tasks done while holding the lock are smaller; e.g. allocating new entries is now performed without holding the lock. The same goes for freeing. 3. The entries are freed as soon as possible (the AVBufferPool API frees them in two batches: The first in av_buffer_pool_uninit() and the second immediately before the pool is freed when the last outstanding entry is returned to the pool). 4. The API is designed for objects and not naked buffers and therefore has a reset callback. This is called whenever an object is returned to the pool. 5. Just like with the RefStruct API, custom allocators are not supported. (If desired, the FFRefStructPool struct itself could be made reference counted via the RefStruct API; an FFRefStructPool would then be freed via ff_refstruct_unref().) Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
10 KiB
10 KiB