diff options
author | Lynne <dev@lynne.ee> | 2024-11-28 00:51:21 +0900 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2024-11-28 01:29:21 +0900 |
commit | 41f65b7326ea437d0b19744810903a5a588047fd (patch) | |
tree | 3aad4260005d2908028d27abee7f407b45280fda | |
parent | a5e6860a890b60ebd46595b2c355ae388f1f2cb4 (diff) | |
download | ffmpeg-41f65b7326ea437d0b19744810903a5a588047fd.tar.gz |
vulkan_decode: ensure there's at least one context per decode thread
Otherwise, what may happen is that 2 threads will both write
into the same context.
-rw-r--r-- | libavcodec/vulkan_decode.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index e55df7ad27..dc5d57ec67 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -1159,7 +1159,8 @@ int ff_vk_decode_init(AVCodecContext *avctx) /* Create decode exec context for this specific main thread. * 2 async contexts per thread was experimentally determined to be optimal * for a majority of streams. */ - err = ff_vk_exec_pool_init(s, &ctx->qf, &dec->exec_pool, 2*ctx->qf.nb_queues, + err = ff_vk_exec_pool_init(s, &ctx->qf, &dec->exec_pool, + FFMAX(2*ctx->qf.nb_queues, avctx->thread_count), nb_q, VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR, 0, profile); if (err < 0) |