Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(video): correctly align data passed to toxcore
Browse files Browse the repository at this point in the history
fixes #5402

c-toxcore requires each plane to be aligned at 1 byte boundaries.
Because of this bug we alligned it at 32 byte boundaries if the height
and width were a multiple of 8.
  • Loading branch information
sudden6 committed Nov 3, 2018
1 parent 9ecb6da commit 5c1fe52
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/video/videoframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,9 @@ AVFrame* VideoFrame::generateAVFrame(const QSize& dimensions, const int pixelFor

int bufSize;

if (!requireAligned || (dimensions.width() % 8 == 0 && dimensions.height() % 8 == 0)) {
const bool alreadyAligned = dimensions.width() % dataAlignment == 0 && dimensions.height() % dataAlignment == 0;

if (!requireAligned || alreadyAligned) {
bufSize = av_image_alloc(ret->data, ret->linesize, dimensions.width(), dimensions.height(),
static_cast<AVPixelFormat>(pixelFormat), dataAlignment);
} else {
Expand Down

0 comments on commit 5c1fe52

Please sign in to comment.