[FFmpeg-devel] [PATCH 2/2] avcodec/decode: sync side_data_pref_mask across worker threads

James Almer jamrial at gmail.com
Sun Apr 27 22:19:16 EEST 2025


On 4/27/2025 3:52 PM, Andreas Rheinhardt wrote:
> James Almer:
>> side_data_pref_mask is set during ff_decode_preinit() and then never copied to
>> worker threads. As such, any decoder calling one of the side data helpers that
>> rely on side_data_pref() in frame threaded scenarios will ignore the user set
>> list of side data types.
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>   libavcodec/decode.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
>> index c2b2dd6e3b..20e99b3ffb 100644
>> --- a/libavcodec/decode.c
>> +++ b/libavcodec/decode.c
>> @@ -2209,6 +2209,7 @@ void ff_decode_internal_sync(AVCodecContext *dst, const AVCodecContext *src)
>>       const DecodeContext *src_dc = decode_ctx(src->internal);
>>       DecodeContext *dst_dc = decode_ctx(dst->internal);
>>   
>> +    dst_dc->side_data_pref_mask = src_dc->side_data_pref_mask;
>>       av_refstruct_replace(&dst_dc->lcevc, src_dc->lcevc);
>>   }
>>   
> 
> Why is this done for every frame, even though it does not change after
> preinit?

I think the ff_decode_internal_sync() call in 
update_context_from_thread() from pthread_frame.c could be removed?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250427/2ac0bb35/attachment.sig>


More information about the ffmpeg-devel mailing list