1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 01:18:38 -05:00

Remote output: removed remaining references to Tx delay

This commit is contained in:
f4exb 2021-12-07 06:31:17 +01:00
parent 4faa3dbe8c
commit 20ed490018
6 changed files with 0 additions and 55 deletions

View File

@ -100,8 +100,6 @@ bool RemoteOutput::start()
m_lastQueueLength = -2; // set first value out of bounds m_lastQueueLength = -2; // set first value out of bounds
m_chunkSizeCorrection = 0; m_chunkSizeCorrection = 0;
m_remoteOutputWorker->setTxDelay(m_settings.m_txDelay);
mutexLocker.unlock(); mutexLocker.unlock();
//applySettings(m_generalSettings, m_settings, true); //applySettings(m_generalSettings, m_settings, true);
qDebug("RemoteOutput::start: started"); qDebug("RemoteOutput::start: started");
@ -260,7 +258,6 @@ void RemoteOutput::applySettings(const RemoteOutputSettings& settings, bool forc
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);
bool forwardChange = false; bool forwardChange = false;
bool changeTxDelay = false;
QList<QString> reverseAPIKeys; QList<QString> reverseAPIKeys;
if ((m_settings.m_dataAddress != settings.m_dataAddress) || force) { 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 m_tickMultiplier = m_tickMultiplier < 20 ? 20 : m_tickMultiplier; // not below half a second
forwardChange = true; forwardChange = true;
changeTxDelay = true;
} }
if (force || (m_settings.m_nbFECBlocks != settings.m_nbFECBlocks)) 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) { if (m_remoteOutputWorker != 0) {
m_remoteOutputWorker->setNbBlocksFEC(settings.m_nbFECBlocks); 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(); mutexLocker.unlock();
qDebug() << "RemoteOutput::applySettings:" qDebug() << "RemoteOutput::applySettings:"
<< " m_sampleRate: " << settings.m_sampleRate << " m_sampleRate: " << settings.m_sampleRate
<< " m_txDelay: " << settings.m_txDelay
<< " m_nbFECBlocks: " << settings.m_nbFECBlocks << " m_nbFECBlocks: " << settings.m_nbFECBlocks
<< " m_apiAddress: " << settings.m_apiAddress << " m_apiAddress: " << settings.m_apiAddress
<< " m_apiPort: " << settings.m_apiPort << " m_apiPort: " << settings.m_apiPort
@ -421,9 +401,6 @@ void RemoteOutput::webapiUpdateDeviceSettings(
if (deviceSettingsKeys.contains("sampleRate")) { if (deviceSettingsKeys.contains("sampleRate")) {
settings.m_sampleRate = response.getRemoteOutputSettings()->getSampleRate(); settings.m_sampleRate = response.getRemoteOutputSettings()->getSampleRate();
} }
if (deviceSettingsKeys.contains("txDelay")) {
settings.m_txDelay = response.getRemoteOutputSettings()->getTxDelay();
}
if (deviceSettingsKeys.contains("nbFECBlocks")) { if (deviceSettingsKeys.contains("nbFECBlocks")) {
settings.m_nbFECBlocks = response.getRemoteOutputSettings()->getNbFecBlocks(); settings.m_nbFECBlocks = response.getRemoteOutputSettings()->getNbFecBlocks();
} }
@ -474,7 +451,6 @@ void RemoteOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& re
{ {
response.getRemoteOutputSettings()->setCenterFrequency(settings.m_centerFrequency); response.getRemoteOutputSettings()->setCenterFrequency(settings.m_centerFrequency);
response.getRemoteOutputSettings()->setSampleRate(settings.m_sampleRate); response.getRemoteOutputSettings()->setSampleRate(settings.m_sampleRate);
response.getRemoteOutputSettings()->setTxDelay(settings.m_txDelay);
response.getRemoteOutputSettings()->setNbFecBlocks(settings.m_nbFECBlocks); response.getRemoteOutputSettings()->setNbFecBlocks(settings.m_nbFECBlocks);
response.getRemoteOutputSettings()->setApiAddress(new QString(settings.m_apiAddress)); response.getRemoteOutputSettings()->setApiAddress(new QString(settings.m_apiAddress));
response.getRemoteOutputSettings()->setApiPort(settings.m_apiPort); response.getRemoteOutputSettings()->setApiPort(settings.m_apiPort);
@ -659,9 +635,6 @@ void RemoteOutput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys,
if (deviceSettingsKeys.contains("sampleRate") || force) { if (deviceSettingsKeys.contains("sampleRate") || force) {
swgRemoteOutputSettings->setSampleRate(settings.m_sampleRate); swgRemoteOutputSettings->setSampleRate(settings.m_sampleRate);
} }
if (deviceSettingsKeys.contains("txDelay") || force) {
swgRemoteOutputSettings->setTxDelay(settings.m_txDelay);
}
if (deviceSettingsKeys.contains("nbFECBlocks") || force) { if (deviceSettingsKeys.contains("nbFECBlocks") || force) {
swgRemoteOutputSettings->setNbFecBlocks(settings.m_nbFECBlocks); swgRemoteOutputSettings->setNbFecBlocks(settings.m_nbFECBlocks);
} }

View File

@ -27,7 +27,6 @@ void RemoteOutputSettings::resetToDefaults()
{ {
m_centerFrequency = 435000*1000; m_centerFrequency = 435000*1000;
m_sampleRate = 48000; m_sampleRate = 48000;
m_txDelay = 0.35;
m_nbFECBlocks = 0; m_nbFECBlocks = 0;
m_apiAddress = "127.0.0.1"; m_apiAddress = "127.0.0.1";
m_apiPort = 9091; m_apiPort = 9091;
@ -47,7 +46,6 @@ QByteArray RemoteOutputSettings::serialize() const
s.writeU64(1, m_centerFrequency); s.writeU64(1, m_centerFrequency);
s.writeU32(2, m_sampleRate); s.writeU32(2, m_sampleRate);
s.writeFloat(3, m_txDelay);
s.writeU32(4, m_nbFECBlocks); s.writeU32(4, m_nbFECBlocks);
s.writeString(5, m_apiAddress); s.writeString(5, m_apiAddress);
s.writeU32(6, m_apiPort); s.writeU32(6, m_apiPort);
@ -79,7 +77,6 @@ bool RemoteOutputSettings::deserialize(const QByteArray& data)
d.readU64(1, &m_centerFrequency, 435000*1000); d.readU64(1, &m_centerFrequency, 435000*1000);
d.readU32(2, &m_sampleRate, 48000); d.readU32(2, &m_sampleRate, 48000);
d.readFloat(3, &m_txDelay, 0.5);
d.readU32(4, &m_nbFECBlocks, 0); d.readU32(4, &m_nbFECBlocks, 0);
d.readString(5, &m_apiAddress, "127.0.0.1"); d.readString(5, &m_apiAddress, "127.0.0.1");
d.readU32(6, &uintval, 9090); d.readU32(6, &uintval, 9090);

View File

@ -24,7 +24,6 @@
struct RemoteOutputSettings { struct RemoteOutputSettings {
quint64 m_centerFrequency; quint64 m_centerFrequency;
quint32 m_sampleRate; quint32 m_sampleRate;
float m_txDelay;
quint32 m_nbFECBlocks; quint32 m_nbFECBlocks;
QString m_apiAddress; QString m_apiAddress;
quint16 m_apiPort; quint16 m_apiPort;

View File

@ -49,7 +49,6 @@ public:
void setSamplerate(int samplerate); void setSamplerate(int samplerate);
void setNbBlocksFEC(uint32_t nbBlocksFEC) { m_udpSinkFEC.setNbBlocksFEC(nbBlocksFEC); }; 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); } void setDataAddress(const QString& address, uint16_t port) { m_udpSinkFEC.setRemoteAddress(address, port); }
bool isRunning() const { return m_running; } bool isRunning() const { return m_running; }

View File

@ -32,7 +32,6 @@ UDPSinkFEC::UDPSinkFEC() :
m_nbSamples(0), m_nbSamples(0),
m_nbBlocksFEC(0), m_nbBlocksFEC(0),
m_txDelayRatio(0.0), m_txDelayRatio(0.0),
m_txDelay(0),
m_dataBlock(nullptr), m_dataBlock(nullptr),
m_txBlockIndex(0), m_txBlockIndex(0),
m_txBlocksIndex(0), m_txBlocksIndex(0),
@ -71,35 +70,16 @@ void UDPSinkFEC::stopSender()
m_senderThread->wait(); 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) void UDPSinkFEC::setNbBlocksFEC(uint32_t nbBlocksFEC)
{ {
qDebug() << "UDPSinkFEC::setNbBlocksFEC: nbBlocksFEC: " << nbBlocksFEC; qDebug() << "UDPSinkFEC::setNbBlocksFEC: nbBlocksFEC: " << nbBlocksFEC;
m_nbBlocksFEC = nbBlocksFEC; m_nbBlocksFEC = nbBlocksFEC;
setTxDelay(m_txDelayRatio);
} }
void UDPSinkFEC::setSampleRate(uint32_t sampleRate) void UDPSinkFEC::setSampleRate(uint32_t sampleRate)
{ {
qDebug() << "UDPSinkFEC::setSampleRate: sampleRate: " << sampleRate; qDebug() << "UDPSinkFEC::setSampleRate: sampleRate: " << sampleRate;
m_sampleRate = sampleRate; m_sampleRate = sampleRate;
setTxDelay(m_txDelayRatio);
} }
void UDPSinkFEC::setRemoteAddress(const QString& address, uint16_t port) 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_processed = false;
m_dataBlock->m_txControlBlock.m_complete = true; m_dataBlock->m_txControlBlock.m_complete = true;
m_dataBlock->m_txControlBlock.m_nbBlocksFEC = m_nbBlocksFEC; 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_dataAddress = m_remoteAddress;
m_dataBlock->m_txControlBlock.m_dataPort = m_remotePort; m_dataBlock->m_txControlBlock.m_dataPort = m_remotePort;

View File

@ -67,7 +67,6 @@ public:
void setSampleRate(uint32_t sampleRate); void setSampleRate(uint32_t sampleRate);
void setNbBlocksFEC(uint32_t nbBlocksFEC); void setNbBlocksFEC(uint32_t nbBlocksFEC);
void setTxDelay(float txDelayRatio);
void setRemoteAddress(const QString& address, uint16_t port); void setRemoteAddress(const QString& address, uint16_t port);
/** Return true if the stream is OK, return false if there is an error. */ /** 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 RemoteMetaDataFEC m_currentMetaFEC; //!< Meta data for current frame
uint32_t m_nbBlocksFEC; //!< Variable number of FEC blocks uint32_t m_nbBlocksFEC; //!< Variable number of FEC blocks
float m_txDelayRatio; //!< Delay in ratio of nominal frame period 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; RemoteDataBlock *m_dataBlock;
RemoteSuperBlock m_superBlock; //!< current super block being built RemoteSuperBlock m_superBlock; //!< current super block being built
int m_txBlockIndex; //!< Current index in blocks to transmit in the Tx row int m_txBlockIndex; //!< Current index in blocks to transmit in the Tx row