[FFmpeg-devel] [PATCH 7/7 v5] avcodec/hevcdec: export global side data in AVCodecContext

James Almer jamrial at gmail.com
Wed Apr 3 14:31:15 EEST 2024


On 4/3/2024 5:32 AM, Anton Khirnov wrote:
> Quoting James Almer (2024-03-28 17:52:50)
>> diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
>> index fd356bd190..a693e12670 100644
>> --- a/libavcodec/pthread_frame.c
>> +++ b/libavcodec/pthread_frame.c
>> @@ -334,6 +334,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
>>       if (for_user) {
>>           if (codec->update_thread_context_for_user)
>>               err = codec->update_thread_context_for_user(dst, src);
>> +
>> +        av_frame_side_data_free(&dst->decoded_side_data, &dst->nb_decoded_side_data);
>> +        for (int i = 0; i < src->nb_decoded_side_data; i++) {
>> +            int ret = av_frame_side_data_clone(&dst->decoded_side_data,
>> +                                               &dst->nb_decoded_side_data,
>> +                                               src->decoded_side_data[i], 0);
>> +            if (ret < 0)
>> +                return ret;
>> +        }
> 
> Seems wasteful to do this for every frame, when it only needs to be done
> once. Is there a reason not to put this code in init_thread()?

Hadn't thought about it. Will try that.


More information about the ffmpeg-devel mailing list