#10847: Segmentaion fault using vulkan decoder on Windows with NVIDIA
-----------------------------------+----------------------------------
Reporter: Sn0wCrack | Type: defect
Status: new | Priority: normal
Component: avcodec | Version: 6.1
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-----------------------------------+----------------------------------
I'm currently experiencing a segmentation fault error when attmepting to
use Vulkan as a video decoder as part of the following project:
https://github.com/streetpea/chiaki4deck
After some debugging with the developers I've been directed here as it
seems to be some upstream issue relating to ffmpeg itself. The discussion
can be found here: https://github.com/streetpea/chiaki4deck/issues/239
For debugging I've specifically checked out the n6.1.1 tag to create my
debug build.
The segmentation fault occurs after calling avcodec_send_packet with the
content of the received frame.
I'm currently using an NVIDIA RTX 3080 with driver version 551.23 on the
latest updates of Windows 11.
I have the following stack trace:
{{{
[avcodec-60.dll] ff_vk_exec_add_dep_frame vulkan.c:610
[avcodec-60.dll] ff_vk_decode_frame vulkan_decode.c:527
[avcodec-60.dll] vk_hevc_end_frame vulkan_hevc.c:909
[avcodec-60.dll] hevc_decode_frame hevcdec.c:3360
[avcodec-60.dll] decode_simple_internal decode.c:430
[avcodec-60.dll] decode_simple_receive_frame decode.c:609
[avcodec-60.dll] decode_receive_frame_internal decode.c:637
[avcodec-60.dll] avcodec_send_packet decode.c:734
[chiaki.exe] chiaki_ffmpeg_decoder_video_sample_cb ffmpegdecoder.c:125
[chiaki.exe] chiaki_video_receiver_flush_frame videoreceiver.c:204
[chiaki.exe] chiaki_video_receiver_av_packet videoreceiver.c:144
[chiaki.exe] stream_connection_takion_av streamconnection.c:1018
[chiaki.exe] stream_connection_takion_cb streamconnection.c:380
[chiaki.exe] takion_handle_packet_av takion.c:1265
[chiaki.exe] takion_handle_packet takion.c:922
[chiaki.exe] takion_thread_func takion.c:792
[chiaki.exe] win32_thread_func thread.c:20
[kernel32.dll] BaseThreadInitThunk 0x00007fff4f03257d
[ntdll.dll] RtlUserThreadStart 0x00007fff4fa2aa58
<unknown> 0x0000000000000000
}}}
Applying the following patch seems to resolve the segmentation fault crash
without creating any additional issue in the context of the application
ffmpeg is being used in:
{{{
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index bf8456b..2c9ff96 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -607,6 +607,9 @@ int ff_vk_exec_add_dep_frame(FFVulkanContext *s,
FFVkExecContext *e, AVFrame *f,
uint32_t *queue_family_dst;
VkAccessFlagBits *access_dst;
+ if (!f || !f->hw_frames_ctx)
+ return 1;
+
AVHWFramesContext *hwfc = (AVHWFramesContext
*)f->hw_frames_ctx->data;
AVVulkanFramesContext *vkfc = hwfc->hwctx;
AVVkFrame *vkf = (AVVkFrame *)f->data[0];
}}}
I'm not particularly able to replicate this crash in other applications
utilising ffmpeg, such as mpv or even the ffmpeg command line tool itself.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/10847>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
FFmpeg-trac@avcodec.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac
To unsubscribe, visit link above, or email
ffmpeg-trac-requ...@ffmpeg.org with subject "unsubscribe".