[FFmpeg-devel] [PATCH 4/5] avcodec/h264dec: use the RefStruct API for h264db

James Almer jamrial at gmail.com
Fri Oct 25 15:11:26 EEST 2024


On 10/25/2024 5:17 AM, Anton Khirnov wrote:
> Quoting James Almer (2024-10-25 04:26:12)
>> And ensure the buffer is synced between threads.
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>   libavcodec/h264_picture.c | 2 +-
>>   libavcodec/h264_slice.c   | 2 ++
>>   libavcodec/h264dec.c      | 2 +-
>>   3 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
>> index 371a794ec2..d07c3a0af8 100644
>> --- a/libavcodec/h264_picture.c
>> +++ b/libavcodec/h264_picture.c
>> @@ -215,7 +215,7 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup)
>>           err = AVERROR_INVALIDDATA;
>>           if (sd) { // a decoding error may have happened before the side data could be allocated
>>               if (!h->h274db) {
>> -                h->h274db = av_mallocz(sizeof(*h->h274db));
>> +                h->h274db = ff_refstruct_allocz(sizeof(*h->h274db));
> 
> Doesn't this happen after ff_thread_finish_setup()?

I have no idea. Currently, h274db is not being synced between threads, 
but i think that was also the case before 08b1bffa4971, so maybe this 
patch can be dropped.

-------------- 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/20241025/cff6e2d7/attachment.sig>


More information about the ffmpeg-devel mailing list