Browse Source

Merge pull request #752 from helenol/master

Fix invalid images in mavlink video transmission.
QGC4.4
Lorenz Meier 11 years ago
parent
commit
a1cc1b5ed4
  1. 8
      src/uas/UAS.cc
  2. 7
      src/ui/HUD.cc

8
src/uas/UAS.cc

@ -1387,7 +1387,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
++imagePacketsArrived; ++imagePacketsArrived;
// emit signal if all packets arrived // emit signal if all packets arrived
if ((imagePacketsArrived >= imagePackets)) if (imagePacketsArrived >= imagePackets)
{ {
// Restart statemachine // Restart statemachine
imagePackets = 0; imagePackets = 0;
@ -2202,13 +2202,15 @@ QImage UAS::getImage()
if (!image.loadFromData(imageRecBuffer)) if (!image.loadFromData(imageRecBuffer))
{ {
qDebug() << __FILE__ << __LINE__ << "Loading data from image buffer failed!"; qDebug() << __FILE__ << __LINE__ << "Loading data from image buffer failed!";
return QImage();
} }
} }
// Restart statemachine // Restart statemachine
imagePacketsArrived = 0; imagePacketsArrived = 0;
//imageRecBuffer.clear(); imagePackets = 0;
imageRecBuffer.clear();
return image; return image;
} }
void UAS::requestImage() void UAS::requestImage()

7
src/ui/HUD.cc

@ -119,7 +119,7 @@ HUD::HUD(int width, int height, QWidget* parent)
{ {
Q_UNUSED(width); Q_UNUSED(width);
Q_UNUSED(height); Q_UNUSED(height);
// Set auto fill to false // Set auto fill to false
setAutoFillBackground(false); setAutoFillBackground(false);
@ -1374,7 +1374,10 @@ void HUD::copyImage(UASInterface* uas)
UAS* u = qobject_cast<UAS*>(uas); UAS* u = qobject_cast<UAS*>(uas);
if (u) if (u)
{ {
this->glImage = u->getImage(); QImage temp_im = u->getImage();
if (temp_im.byteCount() > 0) {
this->glImage = temp_im;
}
// Save to directory if logging is enabled // Save to directory if logging is enabled
if (imageLoggingEnabled) if (imageLoggingEnabled)

Loading…
Cancel
Save