Skip to content
Snippets Groups Projects
Commit d940c725 authored by Mohamed Chibani's avatar Mohamed Chibani
Browse files

SMH: fix check on buffer size

The SHM buffer size might be slightly larger than the expected
size due to 16-byte memory alignment used to create the SHM
buffers.

Gitlab: #731

Change-Id: Ida174fd16698cdbe6b19ccfd3c0c266adad68fa2
parent 6f1945af
No related branches found
No related tags found
No related merge requests found
......@@ -229,8 +229,11 @@ VideoProvider::copyUnaligned(QVideoFrame* dst, const video::Frame& src)
// The provided source must be valid.
assert(src.ptr != nullptr and src.size > 0);
if (dst->width() * dst->height() * BYTES_PER_PIXEL != src.size) {
qCritical() << "Size mismatch. Actual " << src.size << " Expected "
// The source buffer must be greater or equal to the min required
// buffer size. The SHM buffer might be slightly larger than the
// required size due to the 16-byte alignment.
if (dst->width() * dst->height() * BYTES_PER_PIXEL > src.size) {
qCritical() << "The size of frame buffer " << src.size << " is smaller than expected "
<< dst->width() * dst->height() * BYTES_PER_PIXEL;
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment