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

Function avcodec_default_get_buffer2

libavcodec/get_buffer.c:253–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251}
252
253int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags)
254{
255 int ret;
256
257 if (avctx->hw_frames_ctx) {
258 ret = av_hwframe_get_buffer(avctx->hw_frames_ctx, frame, 0);
259 if (ret == AVERROR(ENOMEM)) {
260 AVHWFramesContext *frames_ctx =
261 (AVHWFramesContext*)avctx->hw_frames_ctx->data;
262 if (frames_ctx->initial_pool_size > 0 &&
263 !avctx->internal->warned_on_failed_allocation_from_fixed_pool) {
264 av_log(avctx, AV_LOG_WARNING, "Failed to allocate a %s/%s "
265 "frame from a fixed pool of hardware frames.\n",
266 av_get_pix_fmt_name(frames_ctx->format),
267 av_get_pix_fmt_name(frames_ctx->sw_format));
268 av_log(avctx, AV_LOG_WARNING, "Consider setting "
269 "extra_hw_frames to a larger value "
270 "(currently set to %d, giving a pool size of %d).\n",
271 avctx->extra_hw_frames, frames_ctx->initial_pool_size);
272 avctx->internal->warned_on_failed_allocation_from_fixed_pool = 1;
273 }
274 }
275 frame->width = avctx->coded_width;
276 frame->height = avctx->coded_height;
277 return ret;
278 }
279
280 if ((ret = update_frame_pool(avctx, frame)) < 0)
281 return ret;
282
283 switch (avctx->codec_type) {
284 case AVMEDIA_TYPE_VIDEO:
285 return video_get_buffer(avctx, frame);
286 case AVMEDIA_TYPE_AUDIO:
287 return audio_get_buffer(avctx, frame);
288 default:
289 return -1;
290 }
291}

Callers 5

fuzz_get_buffer2Function · 0.85
get_bufferFunction · 0.85
alloc_pictureFunction · 0.85
ff_encode_alloc_frameFunction · 0.85
get_bufferFunction · 0.85

Calls 6

av_hwframe_get_bufferFunction · 0.85
av_logFunction · 0.85
av_get_pix_fmt_nameFunction · 0.85
update_frame_poolFunction · 0.85
video_get_bufferFunction · 0.85
audio_get_bufferFunction · 0.85

Tested by

no test coverage detected