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

7
src/ui/HUD.cc

@ -119,7 +119,7 @@ HUD::HUD(int width, int height, QWidget* parent) @@ -119,7 +119,7 @@ HUD::HUD(int width, int height, QWidget* parent)
{
Q_UNUSED(width);
Q_UNUSED(height);
// Set auto fill to false
setAutoFillBackground(false);
@ -1374,7 +1374,10 @@ void HUD::copyImage(UASInterface* uas) @@ -1374,7 +1374,10 @@ void HUD::copyImage(UASInterface* uas)
UAS* u = qobject_cast<UAS*>(uas);
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
if (imageLoggingEnabled)

Loading…
Cancel
Save