MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / pool_alloc_buffer

Function pool_alloc_buffer

libavutil/buffer.c:361–388  ·  view source on GitHub ↗

allocate a new buffer and override its free() callback so that * it is returned to the pool on free */

Source from the content-addressed store, hash-verified

359/* allocate a new buffer and override its free() callback so that
360 * it is returned to the pool on free */
361static AVBufferRef *pool_alloc_buffer(AVBufferPool *pool)
362{
363 BufferPoolEntry *buf;
364 AVBufferRef *ret;
365
366 av_assert0(pool->alloc || pool->alloc2);
367
368 ret = pool->alloc2 ? pool->alloc2(pool->opaque, pool->size) :
369 pool->alloc(pool->size);
370 if (!ret)
371 return NULL;
372
373 buf = av_mallocz(sizeof(*buf));
374 if (!buf) {
375 av_buffer_unref(&ret);
376 return NULL;
377 }
378
379 buf->data = ret->buffer->data;
380 buf->opaque = ret->buffer->opaque;
381 buf->free = ret->buffer->free;
382 buf->pool = pool;
383
384 ret->buffer->opaque = buf;
385 ret->buffer->free = pool_release_buffer;
386
387 return ret;
388}
389
390AVBufferRef *av_buffer_pool_get(AVBufferPool *pool)
391{

Callers 1

av_buffer_pool_getFunction · 0.85

Calls 2

av_buffer_unrefFunction · 0.85
av_malloczFunction · 0.70

Tested by

no test coverage detected