diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.cpp b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.cpp index bce0818cf..35400c260 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.cpp +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.cpp @@ -29,7 +29,10 @@ SDRdaemonFECBuffer::SDRdaemonFECBuffer(uint32_t throttlems) : m_frameHead(0), m_decoderIndexHead(nbDecoderSlots/2), m_curNbBlocks(0), + m_minNbBlocks(256), m_curNbRecovery(0), + m_maxNbRecovery(0), + m_framesDecoded(true), m_throttlemsNominal(throttlems), m_readIndex(0), m_readBuffer(0), @@ -79,11 +82,23 @@ void SDRdaemonFECBuffer::initDecodeAllSlots() void SDRdaemonFECBuffer::initDecodeSlot(int slotIndex) { // collect stats before voiding the slot + m_curNbBlocks = m_decoderSlots[slotIndex].m_blockCount; m_curNbRecovery = m_decoderSlots[slotIndex].m_recoveryCount; m_avgNbBlocks(m_curNbBlocks); m_avgNbRecovery(m_curNbRecovery); + m_framesDecoded = m_framesDecoded && m_decoderSlots[slotIndex].m_decoded; + + if (m_curNbBlocks < m_minNbBlocks) { + m_minNbBlocks = m_curNbBlocks; + } + + if (m_curNbRecovery > m_maxNbRecovery) { + m_maxNbRecovery = m_curNbRecovery; + } + // void the slot + m_decoderSlots[slotIndex].m_blockCount = 0; m_decoderSlots[slotIndex].m_originalCount = 0; m_decoderSlots[slotIndex].m_recoveryCount = 0; diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.h b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.h index 548531bc8..29b394928 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.h +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecbuffer.h @@ -93,11 +93,33 @@ public: const MetaDataFEC& getCurrentMeta() const { return m_currentMeta; } // stats - int getCurNbBlocks() const { return m_curNbBlocks; } + + int getCurNbBlocks() const { return m_curNbBlocks; } int getCurNbRecovery() const { return m_curNbRecovery; } float getAvgNbBlocks() const { return m_avgNbBlocks; } float getAvgNbRecovery() const { return m_avgNbRecovery; } + int getMinNbBlocks() + { + int minNbBlocks = m_minNbBlocks; + m_minNbBlocks = 256; + return minNbBlocks; + } + + int getMaxNbRecovery() + { + int maxNbRecovery = m_maxNbRecovery; + m_maxNbRecovery = 0; + return maxNbRecovery; + } + + bool allFramesDecoded() + { + bool framesDecoded = m_framesDecoded; + m_framesDecoded = true; + return framesDecoded; + } + float getBufferLengthInSecs() const { return m_bufferLenSec; } int32_t getRWBalanceCorrection() const { return m_balCorrection; } @@ -157,9 +179,12 @@ private: int m_decoderIndexHead; //!< index of the current head frame slot in decoding slots int m_frameHead; //!< index of the current head frame sent int m_curNbBlocks; //!< (stats) instantaneous number of blocks received + int m_minNbBlocks; //!< (stats) minimum number of blocks received since last poll int m_curNbRecovery; //!< (stats) instantaneous number of recovery blocks used + int m_maxNbRecovery; //!< (stats) maximum number of recovery blocks used since last poll MovingAverage m_avgNbBlocks; //!< (stats) average number of blocks received MovingAverage m_avgNbRecovery; //!< (stats) average number of recovery blocks used + bool m_framesDecoded; //!< [stats] true if all frames were decoded since last poll int m_readIndex; //!< current byte read index in frames buffer int m_wrDeltaEstimate; //!< Sampled estimate of write to read indexes difference int m_readNbBytes; //!< Nominal number of bytes per read (50ms) diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.cpp b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.cpp index fc326fc4a..11753660f 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.cpp +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.cpp @@ -50,7 +50,7 @@ SDRdaemonFECGui::SDRdaemonFECGui(DeviceAPI *deviceAPI, QWidget* parent) : m_lastEngineState((DSPDeviceEngine::State)-1), m_sampleRate(0), m_centerFrequency(0), - m_framesComplete(false), + m_allFramesDecoded(false), m_bufferLengthInSecs(0.0), m_bufferGauge(-50), m_samplesCount(0), @@ -285,11 +285,11 @@ bool SDRdaemonFECGui::handleMessage(const Message& message) { m_startingTimeStamp.tv_sec = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).get_tv_sec(); m_startingTimeStamp.tv_usec = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).get_tv_usec(); - m_framesComplete = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getFramesComplete(); + m_allFramesDecoded = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAllFramesDecoded(); m_bufferLengthInSecs = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getBufferLengthInSecs(); m_bufferGauge = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getBufferGauge(); - m_curNbBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getCurNbBlocks(); - m_curNbRecovery = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getCurNbRecovery(); + m_minNbBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getMinNbBlocks(); + m_maxNbRecovery = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getmAXNbRecovery(); m_avgNbBlocks = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAvgNbBlocks(); m_avgNbRecovery = ((SDRdaemonFECInput::MsgReportSDRdaemonFECStreamTiming&)message).getAvgNbRecovery(); @@ -581,8 +581,6 @@ void SDRdaemonFECGui::updateWithAcquisition() void SDRdaemonFECGui::updateWithStreamData() { ui->centerFrequency->setValue(m_centerFrequency / 1000); - QString s1 = QString::number(m_sampleRate/1000.0, 'f', 3); - ui->sampleRateText->setText(tr("%1").arg(s1)); updateWithStreamTime(); } @@ -599,10 +597,10 @@ void SDRdaemonFECGui::updateWithStreamTime() QString s_date = dt.toString("yyyy-MM-dd hh:mm:ss.zzz"); ui->absTimeText->setText(s_date); - if (m_framesComplete) { - ui->framesComplete->setStyleSheet("QToolButton { background-color : green; }"); + if (m_allFramesDecoded) { + ui->allFramesDecoded->setStyleSheet("QToolButton { background-color : green; }"); } else { - ui->framesComplete->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); + ui->allFramesDecoded->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); } QString s = QString::number(m_bufferLengthInSecs, 'f', 1); @@ -614,13 +612,13 @@ void SDRdaemonFECGui::updateWithStreamTime() ui->bufferGaugeNegative->setValue((m_bufferGauge < 0 ? -m_bufferGauge : 0)); ui->bufferGaugePositive->setValue((m_bufferGauge < 0 ? 0 : m_bufferGauge)); - s = QString::number(m_curNbBlocks, 'f', 0); - ui->avgNbBlocksText->setText(tr("%1").arg(s)); + s = QString::number(m_minNbBlocks, 'f', 0); + ui->minNbBlocksText->setText(tr("%1").arg(s)); s = QString::number(m_avgNbBlocks, 'f', 1); ui->avgNbBlocksText->setText(tr("%1").arg(s)); - s = QString::number(m_curNbRecovery, 'f', 0); + s = QString::number(m_maxNbRecovery, 'f', 0); ui->curNbRecoveryText->setText(tr("%1").arg(s)); s = QString::number(m_avgNbRecovery, 'f', 1); diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.h b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.h index 391623c65..ab32292f9 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.h +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.h @@ -64,11 +64,11 @@ private: int m_sampleRate; quint64 m_centerFrequency; struct timeval m_startingTimeStamp; - bool m_framesComplete; + bool m_allFramesDecoded; float m_bufferLengthInSecs; int32_t m_bufferGauge; - int m_curNbBlocks; - int m_curNbRecovery; + int m_minNbBlocks; + int m_maxNbRecovery; float m_avgNbBlocks; float m_avgNbRecovery; diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.ui b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.ui index 31bd7a359..533483b86 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.ui +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecgui.ui @@ -304,7 +304,7 @@ - + false @@ -321,59 +321,7 @@ - - - - 70 - 0 - - - - Actual sample rate (kS/s) - - - 00000.000 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Vertical - - - - - - - - 22 - 0 - - - - Main buffer read/write positions unbalance (%): positive means read leads - - - -00 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Vertical - - - - - + 24 @@ -381,10 +329,10 @@ - Total number of blocks retrieved per frame + Minimum number of blocks retrieved per frame - 128 + 000 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -433,7 +381,7 @@ - Number of recovery blocks used per frame + Maximum number of recovery blocks used per frame 000 @@ -501,6 +449,32 @@ + + + + Qt::Vertical + + + + + + + + 22 + 0 + + + + Main buffer read/write positions unbalance (%): positive means read leads + + + -00 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecinput.h b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecinput.h index 8d7b2ec70..01ce8a510 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecinput.h +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecinput.h @@ -166,11 +166,11 @@ public: public: uint32_t get_tv_sec() const { return m_tv_sec; } uint32_t get_tv_usec() const { return m_tv_usec; } - bool getFramesComplete() const { return m_framesComplete; } + bool getAllFramesDecoded() const { return m_allFramesDecoded; } float getBufferLengthInSecs() const { return m_bufferLenSec; } int32_t getBufferGauge() const { return m_bufferGauge; } - int getCurNbBlocks() const { return m_curNbBlocks; } - int getCurNbRecovery() const { return m_curNbRecovery; } + int getMinNbBlocks() const { return m_minNbBlocks; } + int getmAXNbRecovery() const { return m_maxNbRecovery; } float getAvgNbBlocks() const { return m_avgNbBlocks; } float getAvgNbRecovery() const { return m_avgNbRecovery; } @@ -178,7 +178,7 @@ public: uint32_t tv_usec, float bufferLenSec, int32_t bufferGauge, - int nbOriginalBlocks, + bool allFramesDecoded, int curNbBlocks, int curNbRecovery, float avgNbBlocks, @@ -188,7 +188,7 @@ public: tv_usec, bufferLenSec, bufferGauge, - nbOriginalBlocks, + allFramesDecoded, curNbBlocks, curNbRecovery, avgNbBlocks, @@ -198,11 +198,11 @@ public: protected: uint32_t m_tv_sec; uint32_t m_tv_usec; - bool m_framesComplete; + bool m_allFramesDecoded; float m_bufferLenSec; int32_t m_bufferGauge; - int m_curNbBlocks; - int m_curNbRecovery; + int m_minNbBlocks; + int m_maxNbRecovery; float m_avgNbBlocks; float m_avgNbRecovery; @@ -210,7 +210,7 @@ public: uint32_t tv_usec, float bufferLenSec, int32_t bufferGauge, - int nbOriginalBlocks, + bool allFramesDecoded, int curNbBlocks, int curNbRecovery, float avgNbBlocks, @@ -218,11 +218,11 @@ public: Message(), m_tv_sec(tv_sec), m_tv_usec(tv_usec), - m_framesComplete(curNbBlocks == nbOriginalBlocks), + m_allFramesDecoded(allFramesDecoded), m_bufferLenSec(bufferLenSec), m_bufferGauge(bufferGauge), - m_curNbBlocks(curNbBlocks), - m_curNbRecovery(curNbRecovery), + m_minNbBlocks(curNbBlocks), + m_maxNbRecovery(curNbRecovery), m_avgNbBlocks(avgNbBlocks), m_avgNbRecovery(avgNbRecovery) { } diff --git a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp index 91568e259..57b531aae 100644 --- a/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp +++ b/plugins/samplesource/sdrdaemonfec/sdrdaemonfecudphandler.cpp @@ -227,9 +227,9 @@ void SDRdaemonFECUDPHandler::tick() m_tv_usec, m_sdrDaemonBuffer.getBufferLengthInSecs(), m_sdrDaemonBuffer.getBufferGauge(), - SDRdaemonFECBuffer::m_nbOriginalBlocks, - m_sdrDaemonBuffer.getCurNbBlocks(), - m_sdrDaemonBuffer.getCurNbRecovery(), + m_sdrDaemonBuffer.allFramesDecoded(), + m_sdrDaemonBuffer.getMinNbBlocks(), + m_sdrDaemonBuffer.getMaxNbRecovery(), m_sdrDaemonBuffer.getAvgNbBlocks(), m_sdrDaemonBuffer.getAvgNbRecovery()); m_outputMessageQueueToGUI->push(report);