From 6540979108961bce76b206ca443a3c2aea88c8a0 Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 12 Jul 2016 04:44:44 +0200 Subject: [PATCH] SDRdaemonFEC support. allow for smaller datagrams than the UDP block size --- plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.cpp | 2 -- plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.cpp b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.cpp index c745a6ad8..c0e62649e 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.cpp +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.cpp @@ -127,8 +127,6 @@ void SDRdaemonFECBuffer::initDecodeSlot(int slotIndex) void SDRdaemonFECBuffer::writeData(char *array, uint32_t length) { - assert(length == m_udpPayloadSize); - SuperBlock *superBlock = (SuperBlock *) array; int frameIndex = superBlock->header.frameIndex; int decoderIndex = frameIndex % nbDecoderSlots; diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp index ea4bed67b..5df487194 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp @@ -129,13 +129,16 @@ void SDRdaemonFECUDPHandler::configureUDPLink(const QString& address, quint16 po void SDRdaemonFECUDPHandler::dataReadyRead() { + m_udpReadBytes = 0; + while (m_dataSocket->hasPendingDatagrams()) { qint64 pendingDataSize = m_dataSocket->pendingDatagramSize(); - m_udpReadBytes = m_dataSocket->readDatagram(m_udpBuf, pendingDataSize, &m_remoteAddress, 0); + m_udpReadBytes += m_dataSocket->readDatagram(&m_udpBuf[m_udpReadBytes], pendingDataSize, &m_remoteAddress, 0); if (m_udpReadBytes == SDRdaemonFECBuffer::m_udpPayloadSize) { processData(); + m_udpReadBytes = 0; } } }