[FFmpeg-devel] [PATCH v2 02/27] avcodec/decode: Add new ProgressFrame API

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Apr 10 10:09:00 EEST 2024


Anton Khirnov:
> Quoting Andreas Rheinhardt (2024-04-08 22:13:40)
>> diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
>> index fd356bd190..6b2c4312e0 100644
>> --- a/libavcodec/pthread_frame.c
>> +++ b/libavcodec/pthread_frame.c
>> @@ -779,6 +779,7 @@ static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,
>>      if (!copy->internal)
>>          return AVERROR(ENOMEM);
>>      copy->internal->thread_ctx = p;
>> +    copy->internal->progress_frame_pool = avctx->internal->progress_frame_pool;
> 
> I'd still prefer every thread to have its own reference.
> 
> Looks good otherwise.
> 

The opaque of this pool is the main AVCodecContext; if the main
AVCodecContext is destroyed, the pool is in a state where one can no
longer get new entries from it. So giving every thread its own reference
is pretending to make it an equal co-owner of the pool, but it is not as
the pool must not outlive the main AVCodecContext.

- Andreas



More information about the ffmpeg-devel mailing list