1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

avutil/frame: fix setting plane_padding

STRIDE_ALIGN is a lavc define and is not necessarely 32. And align may be <= 0 at the
point plane_padding is being set.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2024-11-16 13:12:50 -03:00
parent 09122bd15c
commit ea91d978e3

View File

@ -174,7 +174,7 @@ static int get_video_buffer(AVFrame *frame, int align)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
int ret, padded_height;
int plane_padding = FFMAX(16 + 16/*STRIDE_ALIGN*/, align);
int plane_padding;
ptrdiff_t linesizes[4];
size_t total_size, sizes[4];
@ -184,10 +184,11 @@ static int get_video_buffer(AVFrame *frame, int align)
if ((ret = av_image_check_size(frame->width, frame->height, 0, NULL)) < 0)
return ret;
if (!frame->linesize[0]) {
if (align <= 0)
align = ALIGN;
if (align <= 0)
align = ALIGN;
plane_padding = FFMAX(ALIGN, align);
if (!frame->linesize[0]) {
for (int i = 1; i <= align; i += i) {
ret = av_image_fill_linesizes(frame->linesize, frame->format,
FFALIGN(frame->width, i));