From c25c7fda584a555f8388ea3b1cfd0e3e3f11af1c Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 31 Aug 2018 08:47:18 +0200 Subject: [PATCH] SDRDaemonSink GUI: sample rate active feedback (2) --- .../samplesink/sdrdaemonsink/sdrdaemonsinkgui.cpp | 14 ++++++++++---- .../samplesink/sdrdaemonsink/sdrdaemonsinkgui.h | 4 ++-- sdrbase/resources/webapi/doc/html2/index.html | 2 +- sdrdaemon/channel/sdrdaemonchannelsource.cpp | 2 +- sdrdaemon/channel/sdrdaemondatareadqueue.h | 6 ++---- swagger/sdrangel/code/html2/index.html | 2 +- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.cpp b/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.cpp index 98e70281b..eada6d7f3 100644 --- a/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.cpp +++ b/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.cpp @@ -537,7 +537,6 @@ void SDRdaemonSinkGui::analyzeApiReply(const QJsonObject& jsonObject) ui->queueLengthGauge->setValue(queueLengthPercent); int unrecoverableCount = report["uncorrectableErrorsCount"].toInt(); int recoverableCount = report["correctableErrorsCount"].toInt(); - LimitedCounter sampleCount(report["samplesCount"].toInt()); uint64_t timestampUs = report["tvSec"].toInt()*1000000ULL + report["tvUSec"].toInt(); if (m_lastTimestampRateCorrection == 0) { @@ -559,13 +558,20 @@ void SDRdaemonSinkGui::analyzeApiReply(const QJsonObject& jsonObject) displayEventCounts(); } - LimitedCounter sampleCountDelta = sampleCount - m_lastSampleCount; + uint32_t sampleCountDelta, sampleCount; + sampleCount = report["samplesCount"].toInt(); - if (sampleCountDelta.value() == 0) { + if (sampleCount < m_lastSampleCount) { + sampleCountDelta = (0xFFFFFFFFU - sampleCount) + m_lastSampleCount + 1; + } else { + sampleCountDelta = sampleCount - m_lastSampleCount; + } + + if (sampleCountDelta == 0) { ui->allFramesDecoded->setStyleSheet("QToolButton { background-color : blue; }"); } - double remoteStreamRate = sampleCountDelta.value()*1e6 / (double) (timestampUs - m_lastTimestampUs); + double remoteStreamRate = sampleCountDelta*1e6 / (double) (timestampUs - m_lastTimestampUs); if (remoteStreamRate != 0) { diff --git a/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.h b/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.h index c1769c3ce..48dcd901d 100644 --- a/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.h +++ b/plugins/samplesink/sdrdaemonsink/sdrdaemonsinkgui.h @@ -71,7 +71,7 @@ private: int m_sampleRate; quint64 m_deviceCenterFrequency; //!< Center frequency in device int m_samplesCount; - MovingAverageUtil m_rateMovingAverage; // ~2mn average + MovingAverageUtil m_rateMovingAverage; // ~30s average uint32_t m_tickCount; std::size_t m_nbSinceLastFlowCheck; int m_lastEngineState; @@ -82,7 +82,7 @@ private: uint32_t m_countRecovered; uint32_t m_lastCountUnrecoverable; uint32_t m_lastCountRecovered; - LimitedCounter m_lastSampleCount; + uint32_t m_lastSampleCount; uint64_t m_lastTimestampUs; uint64_t m_lastTimestampRateCorrection; bool m_resetCounts; diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index 62a05233f..406dab88e 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -28688,7 +28688,7 @@ except ApiException as e:
- Generated 2018-08-30T01:40:47.594+02:00 + Generated 2018-08-31T08:45:52.974+02:00
diff --git a/sdrdaemon/channel/sdrdaemonchannelsource.cpp b/sdrdaemon/channel/sdrdaemonchannelsource.cpp index cd6b14635..580d2ecba 100644 --- a/sdrdaemon/channel/sdrdaemonchannelsource.cpp +++ b/sdrdaemon/channel/sdrdaemonchannelsource.cpp @@ -407,7 +407,7 @@ void SDRDaemonChannelSource::webapiFormatChannelReport(SWGSDRangel::SWGChannelRe response.getSdrDaemonChannelSourceReport()->setTvUSec(tv.tv_usec); response.getSdrDaemonChannelSourceReport()->setQueueSize(m_dataReadQueue.size()); response.getSdrDaemonChannelSourceReport()->setQueueLength(m_dataReadQueue.length()); - response.getSdrDaemonChannelSourceReport()->setSamplesCount(m_dataReadQueue.readSampleCount().value()); + response.getSdrDaemonChannelSourceReport()->setSamplesCount(m_dataReadQueue.readSampleCount()); response.getSdrDaemonChannelSourceReport()->setCorrectableErrorsCount(m_nbCorrectableErrors); response.getSdrDaemonChannelSourceReport()->setUncorrectableErrorsCount(m_nbUncorrectableErrors); } diff --git a/sdrdaemon/channel/sdrdaemondatareadqueue.h b/sdrdaemon/channel/sdrdaemondatareadqueue.h index 4390a435d..ba43d2c47 100644 --- a/sdrdaemon/channel/sdrdaemondatareadqueue.h +++ b/sdrdaemon/channel/sdrdaemondatareadqueue.h @@ -25,8 +25,6 @@ #include -#include "util/limitedcounter.h" - class SDRDaemonDataBlock; class Sample; @@ -42,7 +40,7 @@ public: uint32_t length() const { return m_dataReadQueue.size(); } //!< Returns queue length uint32_t size() const { return m_maxSize; } //!< Returns queue size (max length) void setSize(uint32_t size); //!< Sets the queue size (max length) - LimitedCounter readSampleCount() const { return m_sampleCount; } //!< Returns the absolute number of samples read + uint32_t readSampleCount() const { return m_sampleCount; } //!< Returns the absolute number of samples read static const uint32_t MinimumMaxSize; @@ -52,7 +50,7 @@ private: uint32_t m_maxSize; uint32_t m_blockIndex; uint32_t m_sampleIndex; - LimitedCounter m_sampleCount; //!< use a counter capped below 2^31 as it is going to be converted to an int in the web interface + uint32_t m_sampleCount; //!< use a counter capped below 2^31 as it is going to be converted to an int in the web interface bool m_full; //!< full condition was hit }; diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 62a05233f..406dab88e 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -28688,7 +28688,7 @@ except ApiException as e:
- Generated 2018-08-30T01:40:47.594+02:00 + Generated 2018-08-31T08:45:52.974+02:00