diff options
author | Mark Thompson <sw@jkqxz.net> | 2018-01-29 22:55:11 +0000 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2018-02-11 22:00:48 +0000 |
commit | cad739dace55e3446ef7180de688173cd19fb000 (patch) | |
tree | fc1bcae97b28bb85b9600228e98195f39dd1f6da /libavcodec/decode.c | |
parent | 5b145290df2998a9836a93eb925289c6c8b63af0 (diff) | |
download | ffmpeg-cad739dace55e3446ef7180de688173cd19fb000.tar.gz |
lavc: Add per-thread surfaces in get_hw_frame_parameters()
This number is definitely required when frame threading is enabled, so
add it here rather than forcing all users to handle it themselves.
DXVA2 contained this addition in specific code as well (therefore being
added twice in the internal case) - just remove it from there.
Diffstat (limited to 'libavcodec/decode.c')
-rw-r--r-- | libavcodec/decode.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/decode.c b/libavcodec/decode.c index e024a32321..8635aec949 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -748,10 +748,6 @@ int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx, // We guarantee 4 base work surfaces. The function above guarantees 1 // (the absolute minimum), so add the missing count. frames_ctx->initial_pool_size += 3; - - // Add an additional surface per thread is frame threading is enabled. - if (avctx->active_thread_type & FF_THREAD_FRAME) - frames_ctx->initial_pool_size += avctx->thread_count; } ret = av_hwframe_ctx_init(avctx->hw_frames_ctx); @@ -798,6 +794,11 @@ int avcodec_get_hw_frames_parameters(AVCodecContext *avctx, // available then add them here. if (avctx->extra_hw_frames > 0) frames_ctx->initial_pool_size += avctx->extra_hw_frames; + + // If frame threading is enabled then an extra surface per thread + // is also required. + if (avctx->active_thread_type & FF_THREAD_FRAME) + frames_ctx->initial_pool_size += avctx->thread_count; } *out_frames_ref = frames_ref; |