diff mbox series

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

Message ID 20221120170625.3578-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel] avfilter/framepool: use aligned height when allocating plane buffers | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer Nov. 20, 2022, 5:06 p.m. UTC
Fixes tickets #10051 and #10052.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavfilter/framepool.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Paul B Mahol Nov. 20, 2022, 5:40 p.m. UTC | #1
On 11/20/22, James Almer <jamrial@gmail.com> wrote:
> Fixes tickets #10051 and #10052.
>

Not real fix, more like big hack.

> Signed-off-by: James Almer <jamrial@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@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
James Almer Nov. 20, 2022, 5:45 p.m. UTC | #2
On 11/20/2022 2:40 PM, Paul B Mahol wrote:
> On 11/20/22, James Almer <jamrial@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@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@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
StreamNG Harold Camargo Nov. 20, 2022, 7:41 p.m. UTC | #3
Hello, unsuscribe.

bye

Harold F. Camargo R.
Stream NG
Cel. 318 3227862
Bogotá Colombia
www.stream-ng.com


El dom, 20 nov 2022 a las 12:06, James Almer (<jamrial@gmail.com>) escribió:

> Fixes tickets #10051 and #10052.
>
> Signed-off-by: James Almer <jamrial@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@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
diff mbox series

Patch

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;
     }