From 20ed4900181e7a24f019eab14c8463ddcf8e3337 Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 7 Dec 2021 06:31:17 +0100 Subject: [PATCH] Remote output: removed remaining references to Tx delay --- .../samplesink/remoteoutput/remoteoutput.cpp | 27 ------------------- .../remoteoutput/remoteoutputsettings.cpp | 3 --- .../remoteoutput/remoteoutputsettings.h | 1 - .../remoteoutput/remoteoutputworker.h | 1 - .../samplesink/remoteoutput/udpsinkfec.cpp | 21 --------------- plugins/samplesink/remoteoutput/udpsinkfec.h | 2 -- 6 files changed, 55 deletions(-) diff --git a/plugins/samplesink/remoteoutput/remoteoutput.cpp b/plugins/samplesink/remoteoutput/remoteoutput.cpp index 89a7ae530..14b621c3f 100644 --- a/plugins/samplesink/remoteoutput/remoteoutput.cpp +++ b/plugins/samplesink/remoteoutput/remoteoutput.cpp @@ -100,8 +100,6 @@ bool RemoteOutput::start() m_lastQueueLength = -2; // set first value out of bounds m_chunkSizeCorrection = 0; - m_remoteOutputWorker->setTxDelay(m_settings.m_txDelay); - mutexLocker.unlock(); //applySettings(m_generalSettings, m_settings, true); qDebug("RemoteOutput::start: started"); @@ -260,7 +258,6 @@ void RemoteOutput::applySettings(const RemoteOutputSettings& settings, bool forc { QMutexLocker mutexLocker(&m_mutex); bool forwardChange = false; - bool changeTxDelay = false; QList reverseAPIKeys; if ((m_settings.m_dataAddress != settings.m_dataAddress) || force) { @@ -295,7 +292,6 @@ void RemoteOutput::applySettings(const RemoteOutputSettings& settings, bool forc m_tickMultiplier = m_tickMultiplier < 20 ? 20 : m_tickMultiplier; // not below half a second forwardChange = true; - changeTxDelay = true; } if (force || (m_settings.m_nbFECBlocks != settings.m_nbFECBlocks)) @@ -305,28 +301,12 @@ void RemoteOutput::applySettings(const RemoteOutputSettings& settings, bool forc if (m_remoteOutputWorker != 0) { m_remoteOutputWorker->setNbBlocksFEC(settings.m_nbFECBlocks); } - - changeTxDelay = true; - } - - if (force || (m_settings.m_txDelay != settings.m_txDelay)) - { - reverseAPIKeys.append("txDelay"); - changeTxDelay = true; - } - - if (changeTxDelay) - { - if (m_remoteOutputWorker != 0) { - m_remoteOutputWorker->setTxDelay(settings.m_txDelay); - } } mutexLocker.unlock(); qDebug() << "RemoteOutput::applySettings:" << " m_sampleRate: " << settings.m_sampleRate - << " m_txDelay: " << settings.m_txDelay << " m_nbFECBlocks: " << settings.m_nbFECBlocks << " m_apiAddress: " << settings.m_apiAddress << " m_apiPort: " << settings.m_apiPort @@ -421,9 +401,6 @@ void RemoteOutput::webapiUpdateDeviceSettings( if (deviceSettingsKeys.contains("sampleRate")) { settings.m_sampleRate = response.getRemoteOutputSettings()->getSampleRate(); } - if (deviceSettingsKeys.contains("txDelay")) { - settings.m_txDelay = response.getRemoteOutputSettings()->getTxDelay(); - } if (deviceSettingsKeys.contains("nbFECBlocks")) { settings.m_nbFECBlocks = response.getRemoteOutputSettings()->getNbFecBlocks(); } @@ -474,7 +451,6 @@ void RemoteOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& re { response.getRemoteOutputSettings()->setCenterFrequency(settings.m_centerFrequency); response.getRemoteOutputSettings()->setSampleRate(settings.m_sampleRate); - response.getRemoteOutputSettings()->setTxDelay(settings.m_txDelay); response.getRemoteOutputSettings()->setNbFecBlocks(settings.m_nbFECBlocks); response.getRemoteOutputSettings()->setApiAddress(new QString(settings.m_apiAddress)); response.getRemoteOutputSettings()->setApiPort(settings.m_apiPort); @@ -659,9 +635,6 @@ void RemoteOutput::webapiReverseSendSettings(QList& deviceSettingsKeys, if (deviceSettingsKeys.contains("sampleRate") || force) { swgRemoteOutputSettings->setSampleRate(settings.m_sampleRate); } - if (deviceSettingsKeys.contains("txDelay") || force) { - swgRemoteOutputSettings->setTxDelay(settings.m_txDelay); - } if (deviceSettingsKeys.contains("nbFECBlocks") || force) { swgRemoteOutputSettings->setNbFecBlocks(settings.m_nbFECBlocks); } diff --git a/plugins/samplesink/remoteoutput/remoteoutputsettings.cpp b/plugins/samplesink/remoteoutput/remoteoutputsettings.cpp index 071803288..ddd2735b7 100644 --- a/plugins/samplesink/remoteoutput/remoteoutputsettings.cpp +++ b/plugins/samplesink/remoteoutput/remoteoutputsettings.cpp @@ -27,7 +27,6 @@ void RemoteOutputSettings::resetToDefaults() { m_centerFrequency = 435000*1000; m_sampleRate = 48000; - m_txDelay = 0.35; m_nbFECBlocks = 0; m_apiAddress = "127.0.0.1"; m_apiPort = 9091; @@ -47,7 +46,6 @@ QByteArray RemoteOutputSettings::serialize() const s.writeU64(1, m_centerFrequency); s.writeU32(2, m_sampleRate); - s.writeFloat(3, m_txDelay); s.writeU32(4, m_nbFECBlocks); s.writeString(5, m_apiAddress); s.writeU32(6, m_apiPort); @@ -79,7 +77,6 @@ bool RemoteOutputSettings::deserialize(const QByteArray& data) d.readU64(1, &m_centerFrequency, 435000*1000); d.readU32(2, &m_sampleRate, 48000); - d.readFloat(3, &m_txDelay, 0.5); d.readU32(4, &m_nbFECBlocks, 0); d.readString(5, &m_apiAddress, "127.0.0.1"); d.readU32(6, &uintval, 9090); diff --git a/plugins/samplesink/remoteoutput/remoteoutputsettings.h b/plugins/samplesink/remoteoutput/remoteoutputsettings.h index fbe9fd18d..52a9aa6d2 100644 --- a/plugins/samplesink/remoteoutput/remoteoutputsettings.h +++ b/plugins/samplesink/remoteoutput/remoteoutputsettings.h @@ -24,7 +24,6 @@ struct RemoteOutputSettings { quint64 m_centerFrequency; quint32 m_sampleRate; - float m_txDelay; quint32 m_nbFECBlocks; QString m_apiAddress; quint16 m_apiPort; diff --git a/plugins/samplesink/remoteoutput/remoteoutputworker.h b/plugins/samplesink/remoteoutput/remoteoutputworker.h index 584615e80..36a993b53 100644 --- a/plugins/samplesink/remoteoutput/remoteoutputworker.h +++ b/plugins/samplesink/remoteoutput/remoteoutputworker.h @@ -49,7 +49,6 @@ public: void setSamplerate(int samplerate); void setNbBlocksFEC(uint32_t nbBlocksFEC) { m_udpSinkFEC.setNbBlocksFEC(nbBlocksFEC); }; - void setTxDelay(float txDelay) { m_udpSinkFEC.setTxDelay(txDelay); }; void setDataAddress(const QString& address, uint16_t port) { m_udpSinkFEC.setRemoteAddress(address, port); } bool isRunning() const { return m_running; } diff --git a/plugins/samplesink/remoteoutput/udpsinkfec.cpp b/plugins/samplesink/remoteoutput/udpsinkfec.cpp index ed7152eb1..fac7a8dd2 100644 --- a/plugins/samplesink/remoteoutput/udpsinkfec.cpp +++ b/plugins/samplesink/remoteoutput/udpsinkfec.cpp @@ -32,7 +32,6 @@ UDPSinkFEC::UDPSinkFEC() : m_nbSamples(0), m_nbBlocksFEC(0), m_txDelayRatio(0.0), - m_txDelay(0), m_dataBlock(nullptr), m_txBlockIndex(0), m_txBlocksIndex(0), @@ -71,35 +70,16 @@ void UDPSinkFEC::stopSender() m_senderThread->wait(); } -void UDPSinkFEC::setTxDelay(float txDelayRatio) -{ - // delay is calculated from the fraction of the nominal UDP block process time - // frame size: 127 * (126 or 63 samples depending on I or Q sample bytes of 2 or 4 bytes respectively) - // divided by sample rate gives the frame process time - // divided by the number of actual blocks including FEC blocks gives the block (i.e. UDP block) process time - m_txDelayRatio = txDelayRatio; - int samplesPerBlock = RemoteNbBytesPerBlock / sizeof(Sample); - double delay = m_sampleRate == 0 ? 1.0 : (127*samplesPerBlock*txDelayRatio) / m_sampleRate; - delay /= 128 + m_nbBlocksFEC; - m_txDelay = delay * 1e6; - qDebug() << "UDPSinkFEC::setTxDelay:" - << "txDelay:" << txDelayRatio - << "m_txDelay:" << m_txDelay << " us" - << "m_sampleRate:" << m_sampleRate; -} - void UDPSinkFEC::setNbBlocksFEC(uint32_t nbBlocksFEC) { qDebug() << "UDPSinkFEC::setNbBlocksFEC: nbBlocksFEC: " << nbBlocksFEC; m_nbBlocksFEC = nbBlocksFEC; - setTxDelay(m_txDelayRatio); } void UDPSinkFEC::setSampleRate(uint32_t sampleRate) { qDebug() << "UDPSinkFEC::setSampleRate: sampleRate: " << sampleRate; m_sampleRate = sampleRate; - setTxDelay(m_txDelayRatio); } void UDPSinkFEC::setRemoteAddress(const QString& address, uint16_t port) @@ -200,7 +180,6 @@ void UDPSinkFEC::write(const SampleVector::iterator& begin, uint32_t sampleChunk m_dataBlock->m_txControlBlock.m_processed = false; m_dataBlock->m_txControlBlock.m_complete = true; m_dataBlock->m_txControlBlock.m_nbBlocksFEC = m_nbBlocksFEC; - m_dataBlock->m_txControlBlock.m_txDelay = m_txDelay; m_dataBlock->m_txControlBlock.m_dataAddress = m_remoteAddress; m_dataBlock->m_txControlBlock.m_dataPort = m_remotePort; diff --git a/plugins/samplesink/remoteoutput/udpsinkfec.h b/plugins/samplesink/remoteoutput/udpsinkfec.h index dadac61d4..04a4e1455 100644 --- a/plugins/samplesink/remoteoutput/udpsinkfec.h +++ b/plugins/samplesink/remoteoutput/udpsinkfec.h @@ -67,7 +67,6 @@ public: void setSampleRate(uint32_t sampleRate); void setNbBlocksFEC(uint32_t nbBlocksFEC); - void setTxDelay(float txDelayRatio); void setRemoteAddress(const QString& address, uint16_t port); /** Return true if the stream is OK, return false if there is an error. */ @@ -87,7 +86,6 @@ private: RemoteMetaDataFEC m_currentMetaFEC; //!< Meta data for current frame uint32_t m_nbBlocksFEC; //!< Variable number of FEC blocks float m_txDelayRatio; //!< Delay in ratio of nominal frame period - uint32_t m_txDelay; //!< Delay in microseconds (usleep) between each sending of an UDP datagram RemoteDataBlock *m_dataBlock; RemoteSuperBlock m_superBlock; //!< current super block being built int m_txBlockIndex; //!< Current index in blocks to transmit in the Tx row