Merge pull request #987 from ArmstrongCN/bugfix/ffmpeg

fix av_image_alloc alignment && check allocation error
This commit is contained in:
Jonathan Thomas
2025-05-23 18:13:29 -05:00
committed by GitHub

View File

@@ -1307,7 +1307,11 @@ bool FFmpegReader::GetAVFrame() {
frameFinished = 1;
packet_status.video_decoded++;
av_image_alloc(pFrame->data, pFrame->linesize, info.width, info.height, (AVPixelFormat)(pStream->codecpar->format), 1);
// align 32 for simd
if (av_image_alloc(pFrame->data, pFrame->linesize, info.width,
info.height, (AVPixelFormat)(pStream->codecpar->format), 32) <= 0) {
throw OutOfMemory("Failed to allocate image buffer", path);
}
av_image_copy(pFrame->data, pFrame->linesize, (const uint8_t**)next_frame->data, next_frame->linesize,
(AVPixelFormat)(pStream->codecpar->format), info.width, info.height);