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

Function hwframe_pool_prealloc

libavutil/hwcontext.c:309–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309static int hwframe_pool_prealloc(AVBufferRef *ref)
310{
311 AVHWFramesContext *ctx = (AVHWFramesContext*)ref->data;
312 AVFrame **frames;
313 int i, ret = 0;
314
315 frames = av_calloc(ctx->initial_pool_size, sizeof(*frames));
316 if (!frames)
317 return AVERROR(ENOMEM);
318
319 for (i = 0; i < ctx->initial_pool_size; i++) {
320 frames[i] = av_frame_alloc();
321 if (!frames[i])
322 goto fail;
323
324 ret = av_hwframe_get_buffer(ref, frames[i], 0);
325 if (ret < 0)
326 goto fail;
327 }
328
329fail:
330 for (i = 0; i < ctx->initial_pool_size; i++)
331 av_frame_free(&frames[i]);
332 av_freep(&frames);
333
334 return ret;
335}
336
337int av_hwframe_ctx_init(AVBufferRef *ref)
338{

Callers 1

av_hwframe_ctx_initFunction · 0.85

Calls 5

av_callocFunction · 0.85
av_frame_allocFunction · 0.85
av_hwframe_get_bufferFunction · 0.85
av_frame_freeFunction · 0.85
av_freepFunction · 0.85

Tested by

no test coverage detected