[FFmpeg-cvslog] vulkan_decode: allow using NULL sequence_params when decoding
Lynne
git at videolan.org
Thu Mar 27 18:27:19 EET 2025
ffmpeg | branch: master | Lynne <dev at lynne.ee> | Thu Mar 27 12:47:11 2025 +0000| [5fc4acae9c764cf8b13d085d2d335bddd12230b5] | committer: Lynne
vulkan_decode: allow using NULL sequence_params when decoding
The function had some checks to allow for this, but as it always tried
to dereference a bufferref, it wasn't fully ready.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5fc4acae9c764cf8b13d085d2d335bddd12230b5
---
libavcodec/vulkan_decode.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
index f670922a75..cab1028e2c 100644
--- a/libavcodec/vulkan_decode.c
+++ b/libavcodec/vulkan_decode.c
@@ -96,11 +96,9 @@ int ff_vk_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
av_refstruct_replace(&dst_ctx->shared_ctx, src_ctx->shared_ctx);
- if (src_ctx->session_params) {
- err = av_buffer_replace(&dst_ctx->session_params, src_ctx->session_params);
- if (err < 0)
- return err;
- }
+ err = av_buffer_replace(&dst_ctx->session_params, src_ctx->session_params);
+ if (err < 0)
+ return err;
dst_ctx->dedicated_dpb = src_ctx->dedicated_dpb;
dst_ctx->external_fg = src_ctx->external_fg;
@@ -381,11 +379,12 @@ int ff_vk_decode_frame(AVCodecContext *avctx,
/* Quirks */
const int layered_dpb = ctx->common.layered_dpb;
- VkVideoSessionParametersKHR *par = (VkVideoSessionParametersKHR *)dec->session_params->data;
VkVideoBeginCodingInfoKHR decode_start = {
.sType = VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR,
.videoSession = ctx->common.session,
- .videoSessionParameters = *par,
+ .videoSessionParameters = dec->session_params ?
+ *((VkVideoSessionParametersKHR *)dec->session_params->data) :
+ VK_NULL_HANDLE,
.referenceSlotCount = vp->decode_info.referenceSlotCount,
.pReferenceSlots = vp->decode_info.pReferenceSlots,
};
More information about the ffmpeg-cvslog
mailing list