Skip to content
Snippets Groups Projects
Commit 641730c4 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

rendermanager: fix rendering on GNU/Linux

use directRenderer storage if libwrap is enabled.
Avoid potential crashes by replacing reserve by resize

GitLab: #580
Change-Id: I5b8d83a6be2157164b755156bb16a424b38c70ad
parent 39c029da
No related branches found
No related tags found
No related merge requests found
...@@ -144,24 +144,28 @@ FrameWrapper::slotFrameUpdated(const QString& id) ...@@ -144,24 +144,28 @@ FrameWrapper::slotFrameUpdated(const QString& id)
unsigned int width = renderer_->size().width(); unsigned int width = renderer_->size().width();
unsigned int height = renderer_->size().height(); unsigned int height = renderer_->size().height();
#ifndef Q_OS_LINUX unsigned int size;
unsigned int size = frame_.storage.size(); QImage::Format imageFormat;
auto imageFormat = QImage::Format_ARGB32_Premultiplied; if (renderer_->useDirectRenderer()) {
#else size = frame_.storage.size();
unsigned int size = frame_.size; imageFormat = QImage::Format_ARGB32_Premultiplied;
auto imageFormat = QImage::Format_ARGB32; } else {
#endif size = frame_.size;
imageFormat = QImage::Format_ARGB32;
}
/* /*
* If the frame is empty or not the expected size, * If the frame is empty or not the expected size,
* do nothing and keep the last rendered QImage. * do nothing and keep the last rendered QImage.
*/ */
if (size != 0 && size == width * height * 4) { if (size != 0 && size == width * height * 4) {
#ifndef Q_OS_LINUX if (renderer_->useDirectRenderer()) {
buffer_ = std::move(frame_.storage); buffer_ = std::move(frame_.storage);
#else } else {
buffer_.reserve(size); // TODO remove this path. storage should work everywhere
std::move(frame_.ptr, frame_.ptr + size, buffer_.begin()); // https://git.jami.net/savoirfairelinux/jami-libclient/-/issues/492
#endif buffer_.resize(size);
std::move(frame_.ptr, frame_.ptr + size, buffer_.begin());
}
image_.reset(new QImage((uchar*) buffer_.data(), width, height, imageFormat)); image_.reset(new QImage((uchar*) buffer_.data(), width, height, imageFormat));
} }
} }
......
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