[FFmpeg-devel] [PATCH] avcodec: uninit hwaccel in case of software decoder

Anton Khirnov anton at khirnov.net
Tue Dec 10 20:29:44 EET 2024


Hi,
Quoting Thomas Guillem via ffmpeg-devel (2024-11-29 11:44:21)
> avcodec_get_hw_frames_parameters(), called by the user from get_format,
> is allocating ctx->internal->hwaccel_priv_data. But the hardware
> decoding setup may fail on the user side and it may fallback to software
> decoding. In that case, ctx->internal->hwaccel_priv_data is still
> allocated but not used anymore.
> 
> Fixes the following assert:
> 
> Assertion p_dst->hwaccel_threadsafe || (!dst->hwaccel && !dst->internal->hwaccel_priv_data) failed at src/libavcodec/pthread_frame.c:426
> ---
>  libavcodec/decode.c | 2 ++
>  1 file changed, 2 insertions(+)

I think the actual problem is that avcodec_get_hw_frames_parameters()
modifies the codec context, even though it's explicitly documented not
to. I discussed this with Lynne on IRC, and she's working on removing
the need for that from vulkan decoding, which should be a more proper
fix here.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list