From eaa9006c467a0cfb81e6bc8c284d2251eb14cbbf Mon Sep 17 00:00:00 2001 From: fattony Date: Tue, 19 Jul 2011 15:01:41 +0200 Subject: [PATCH] increased buffersize to 2^16 bytes --- src/apps/qgcvideo/QGCVideoMainWindow.cc | 110 +++++++++++++++++++++--- src/apps/qgcvideo/QGCVideoMainWindow.h | 4 + src/comm/UDPLink.cc | 2 +- 3 files changed, 102 insertions(+), 14 deletions(-) diff --git a/src/apps/qgcvideo/QGCVideoMainWindow.cc b/src/apps/qgcvideo/QGCVideoMainWindow.cc index 2a1d6629b4..a6754de33c 100644 --- a/src/apps/qgcvideo/QGCVideoMainWindow.cc +++ b/src/apps/qgcvideo/QGCVideoMainWindow.cc @@ -35,6 +35,9 @@ #include "UDPLink.h" #include + QByteArray imageRecBuffer = QByteArray(376*240,255); + static int part = 0; + QGCVideoMainWindow::QGCVideoMainWindow(QWidget *parent) : QMainWindow(parent), link(QHostAddress::Any, 5555), @@ -70,29 +73,110 @@ void QGCVideoMainWindow::receiveBytes(LinkInterface* link, QByteArray data) // Output bytes and load Lenna! QString bytes; + QString index; QString ascii; - for (int i=0; ivideo1Widget->copyImage(test); + ui->video2Widget->copyImage(image); + //ui->video3Widget->copyImage(test); + //ui->video4Widget->copyImage(test); + part = 0; + imageRecBuffer.clear(); + } + + + unsigned char i0 = data[0]; + index.append(QString().sprintf("%02x ", i0)); + + for (int j=0; j 31 && data.at(i) < 127) + if (data.at(j) > 31 && data.at(j) < 127) { - ascii.append(data.at(i)); + ascii.append(data.at(j)); } else { ascii.append(219); } + } - qDebug() << "Received" << data.size() << "bytes"; - qDebug() << bytes; - qDebug() << "ASCII:" << ascii; + qDebug() << "Received" << data.size() << "bytes"; + qDebug() << "index: " <video1Widget->copyImage(test); - ui->video2Widget->copyImage(test); - ui->video3Widget->copyImage(test); - ui->video4Widget->copyImage(test); } diff --git a/src/apps/qgcvideo/QGCVideoMainWindow.h b/src/apps/qgcvideo/QGCVideoMainWindow.h index 428da2a360..97ced32402 100644 --- a/src/apps/qgcvideo/QGCVideoMainWindow.h +++ b/src/apps/qgcvideo/QGCVideoMainWindow.h @@ -35,6 +35,8 @@ #include #include "UDPLink.h" + + namespace Ui { class QGCVideoMainWindow; } @@ -47,7 +49,9 @@ public: explicit QGCVideoMainWindow(QWidget *parent = 0); ~QGCVideoMainWindow(); + public slots: + void receiveBytes(LinkInterface* link, QByteArray data); protected: diff --git a/src/comm/UDPLink.cc b/src/comm/UDPLink.cc index 56fa9f825e..ce53ad0f65 100644 --- a/src/comm/UDPLink.cc +++ b/src/comm/UDPLink.cc @@ -182,7 +182,7 @@ void UDPLink::writeBytes(const char* data, qint64 size) **/ void UDPLink::readBytes() { - const qint64 maxLength = 2048; + const qint64 maxLength = 65536; char data[maxLength]; QHostAddress sender; quint16 senderPort; -- GitLab