[FFmpeg-devel] [PATCH] avcodec: uninit hwaccel in case of software decoder
Thomas Guillem
thomas at gllm.fr
Wed Dec 11 07:29:39 EET 2024
Hi,
On Tue, Dec 10, 2024, at 19:29, Anton Khirnov wrote:
> 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.
Indeed, it seems to be a proper solution.
Note that 6.x and 7.1 will need a backport of the fix (or a workaround like this patch if it is too complex to backport).
>
> --
> Anton Khirnov
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list