Commit 571af073 authored by Edric Milaret's avatar Edric Milaret

video: check consistency between size and storage

- This avoid trying to make a new image with a storage not
large enough.

Change-Id: I78a7e79fd00d49368cadd1f03002481b6898ddec
Tuleap: #136
parent 76d6e327
...@@ -82,7 +82,9 @@ VideoWidget::paintEvent(QPaintEvent *evt) { ...@@ -82,7 +82,9 @@ VideoWidget::paintEvent(QPaintEvent *evt) {
if (renderer_) { if (renderer_) {
{ {
QMutexLocker lock(&mutex_); QMutexLocker lock(&mutex_);
if (currentDistantFrame_.storage.size() != 0) { if (currentDistantFrame_.storage.size() != 0
&& currentDistantFrame_.storage.size() ==
(renderer_->size().height()*renderer_->size().width()*4)) {
frameDistant_ = std::move(currentDistantFrame_.storage); frameDistant_ = std::move(currentDistantFrame_.storage);
distantImage_.reset(new QImage((uchar*)frameDistant_.data(), distantImage_.reset(new QImage((uchar*)frameDistant_.data(),
renderer_->size().width(), renderer_->size().width(),
...@@ -100,7 +102,9 @@ VideoWidget::paintEvent(QPaintEvent *evt) { ...@@ -100,7 +102,9 @@ VideoWidget::paintEvent(QPaintEvent *evt) {
if (previewRenderer_) { if (previewRenderer_) {
{ {
QMutexLocker lock(&mutex_); QMutexLocker lock(&mutex_);
if (currentPreviewFrame_.storage.size() != 0) { if (currentPreviewFrame_.storage.size() != 0
&& currentPreviewFrame_.storage.size() ==
(previewRenderer_->size().height()*previewRenderer_->size().width()*4)) {
framePreview_ = std::move(currentPreviewFrame_.storage); framePreview_ = std::move(currentPreviewFrame_.storage);
previewImage_.reset(new QImage((uchar*)framePreview_.data(), previewImage_.reset(new QImage((uchar*)framePreview_.data(),
previewRenderer_->size().width(), previewRenderer_->size().width(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment