From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- media/ffvpx/libavcodec/get_buffer.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'media/ffvpx/libavcodec/get_buffer.c') diff --git a/media/ffvpx/libavcodec/get_buffer.c b/media/ffvpx/libavcodec/get_buffer.c index 647f8a3df7..9b35fde7c6 100644 --- a/media/ffvpx/libavcodec/get_buffer.c +++ b/media/ffvpx/libavcodec/get_buffer.c @@ -70,12 +70,6 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) { int planar = av_sample_fmt_is_planar(frame->format); ch = frame->ch_layout.nb_channels; -#if FF_API_OLD_CHANNEL_LAYOUT -FF_DISABLE_DEPRECATION_WARNINGS - if (!ch) - ch = frame->channels; -FF_ENABLE_DEPRECATION_WARNINGS -#endif planes = planar ? ch : 1; } @@ -263,6 +257,22 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags if (avctx->hw_frames_ctx) { ret = av_hwframe_get_buffer(avctx->hw_frames_ctx, frame, 0); + if (ret == AVERROR(ENOMEM)) { + AVHWFramesContext *frames_ctx = + (AVHWFramesContext*)avctx->hw_frames_ctx->data; + if (frames_ctx->initial_pool_size > 0 && + !avctx->internal->warned_on_failed_allocation_from_fixed_pool) { + av_log(avctx, AV_LOG_WARNING, "Failed to allocate a %s/%s " + "frame from a fixed pool of hardware frames.\n", + av_get_pix_fmt_name(frames_ctx->format), + av_get_pix_fmt_name(frames_ctx->sw_format)); + av_log(avctx, AV_LOG_WARNING, "Consider setting " + "extra_hw_frames to a larger value " + "(currently set to %d, giving a pool size of %d).\n", + avctx->extra_hw_frames, frames_ctx->initial_pool_size); + avctx->internal->warned_on_failed_allocation_from_fixed_pool = 1; + } + } frame->width = avctx->coded_width; frame->height = avctx->coded_height; return ret; -- cgit v1.2.3