[FFmpeg-devel] [PATCH] avfilter/framepool: use aligned height when allocating plane buffers

James Almer jamrial at gmail.com
Sun Nov 20 19:45:22 EET 2022


On 11/20/2022 2:40 PM, Paul B Mahol wrote:
> On 11/20/22, James Almer <jamrial at gmail.com> wrote:
>> Fixes tickets #10051 and #10052.
>>
> 
> Not real fix, more like big hack.

This is in line with other frame pools like the lavc one. If you know a 
better fix, then please send a patch.

> 
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>   libavfilter/framepool.c | 6 ++----
>>   1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c
>> index 0404589055..7e830c5a3b 100644
>> --- a/libavfilter/framepool.c
>> +++ b/libavfilter/framepool.c
>> @@ -91,15 +91,13 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef*
>> (*alloc)(size_t size),
>>           linesizes[i] = pool->linesize[i];
>>
>>       if (av_image_fill_plane_sizes(sizes, pool->format,
>> -                                  pool->height,
>> +                                  FFALIGN(pool->height, align),
>>                                     linesizes) < 0) {
>>           goto fail;
>>       }
>>
>>       for (i = 0; i < 4 && sizes[i]; i++) {
>> -        if (sizes[i] > SIZE_MAX - align)
>> -            goto fail;
>> -        pool->pools[i] = av_buffer_pool_init(sizes[i] + align, alloc);
>> +        pool->pools[i] = av_buffer_pool_init(sizes[i], alloc);
>>           if (!pool->pools[i])
>>               goto fail;
>>       }
>> --
>> 2.38.1
>>
>> _______________________________________________
>> 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".
>>
> _______________________________________________
> 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