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

Remote output: removed tx delay in sending UDP blocks

This commit is contained in:
f4exb 2021-12-07 06:25:40 +01:00
parent 3cb22c8b8a
commit 4faa3dbe8c
4 changed files with 2 additions and 86 deletions

View File

@ -211,20 +211,11 @@ void RemoteOutputSinkGui::updateSampleRate()
ui->deviceRateText->setText(tr("%1k").arg((float)(m_sampleRate) / 1000)); ui->deviceRateText->setText(tr("%1k").arg((float)(m_sampleRate) / 1000));
} }
void RemoteOutputSinkGui::updateTxDelayTooltip()
{
int samplesPerBlock = RemoteNbBytesPerBlock / (SDR_RX_SAMP_SZ <= 16 ? 4 : 8);
double delay = ((127*samplesPerBlock*m_settings.m_txDelay) / m_settings.m_sampleRate)/(128 + m_settings.m_nbFECBlocks);
ui->txDelayText->setToolTip(tr("%1 us").arg(QString::number(delay*1e6, 'f', 0)));
}
void RemoteOutputSinkGui::displaySettings() void RemoteOutputSinkGui::displaySettings()
{ {
blockApplySettings(true); blockApplySettings(true);
ui->centerFrequency->setValue(m_deviceCenterFrequency / 1000); ui->centerFrequency->setValue(m_deviceCenterFrequency / 1000);
ui->sampleRate->setValue(m_settings.m_sampleRate); ui->sampleRate->setValue(m_settings.m_sampleRate);
ui->txDelay->setValue(m_settings.m_txDelay*100);
ui->txDelayText->setText(tr("%1").arg(m_settings.m_txDelay*100));
ui->nbFECBlocks->setValue(m_settings.m_nbFECBlocks); ui->nbFECBlocks->setValue(m_settings.m_nbFECBlocks);
QString s0 = QString::number(128 + m_settings.m_nbFECBlocks, 'f', 0); QString s0 = QString::number(128 + m_settings.m_nbFECBlocks, 'f', 0);
@ -288,15 +279,6 @@ void RemoteOutputSinkGui::updateStatus()
void RemoteOutputSinkGui::on_sampleRate_changed(quint64 value) void RemoteOutputSinkGui::on_sampleRate_changed(quint64 value)
{ {
m_settings.m_sampleRate = value; m_settings.m_sampleRate = value;
updateTxDelayTooltip();
sendSettings();
}
void RemoteOutputSinkGui::on_txDelay_valueChanged(int value)
{
m_settings.m_txDelay = value / 100.0;
ui->txDelayText->setText(tr("%1").arg(value));
updateTxDelayTooltip();
sendSettings(); sendSettings();
} }
@ -308,7 +290,6 @@ void RemoteOutputSinkGui::on_nbFECBlocks_valueChanged(int value)
QString s = QString::number(nbOriginalBlocks + nbFECBlocks, 'f', 0); QString s = QString::number(nbOriginalBlocks + nbFECBlocks, 'f', 0);
QString s1 = QString::number(nbFECBlocks, 'f', 0); QString s1 = QString::number(nbFECBlocks, 'f', 0);
ui->nominalNbBlocksText->setText(tr("%1/%2").arg(s).arg(s1)); ui->nominalNbBlocksText->setText(tr("%1/%2").arg(s).arg(s1));
updateTxDelayTooltip();
sendSettings(); sendSettings();
} }

View File

@ -124,7 +124,6 @@ private:
void sendControl(bool force = false); void sendControl(bool force = false);
void sendSettings(); void sendSettings();
void updateSampleRate(); void updateSampleRate();
void updateTxDelayTooltip();
void displayEventCounts(); void displayEventCounts();
void displayEventStatus(int recoverableCount, int unrecoverableCount); void displayEventStatus(int recoverableCount, int unrecoverableCount);
void displayEventTimer(); void displayEventTimer();
@ -134,7 +133,6 @@ private:
private slots: private slots:
void handleInputMessages(); void handleInputMessages();
void on_sampleRate_changed(quint64 value); void on_sampleRate_changed(quint64 value);
void on_txDelay_valueChanged(int value);
void on_nbFECBlocks_valueChanged(int value); void on_nbFECBlocks_valueChanged(int value);
void on_deviceIndex_returnPressed(); void on_deviceIndex_returnPressed();
void on_channelIndex_returnPressed(); void on_channelIndex_returnPressed();

View File

@ -249,60 +249,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="txDelayLabel">
<property name="text">
<string>UDly</string>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="txDelay">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Delay between consecutive UDP packets in percentage of nominal UDP packet process time</string>
</property>
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>90</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>50</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="txDelayText">
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>90</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">

View File

@ -22,8 +22,6 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <thread>
#include <chrono>
#include <boost/crc.hpp> #include <boost/crc.hpp>
#include <boost/cstdint.hpp> #include <boost/cstdint.hpp>
@ -93,7 +91,6 @@ void RemoteOutputSender::sendDataBlock(RemoteDataBlock *dataBlock)
uint16_t frameIndex = dataBlock->m_txControlBlock.m_frameIndex; uint16_t frameIndex = dataBlock->m_txControlBlock.m_frameIndex;
int nbBlocksFEC = dataBlock->m_txControlBlock.m_nbBlocksFEC; int nbBlocksFEC = dataBlock->m_txControlBlock.m_nbBlocksFEC;
int txDelay = dataBlock->m_txControlBlock.m_txDelay;
m_remoteHostAddress.setAddress(dataBlock->m_txControlBlock.m_dataAddress); m_remoteHostAddress.setAddress(dataBlock->m_txControlBlock.m_dataAddress);
uint16_t dataPort = dataBlock->m_txControlBlock.m_dataPort; uint16_t dataPort = dataBlock->m_txControlBlock.m_dataPort;
RemoteSuperBlock *txBlockx = dataBlock->m_superBlocks; RemoteSuperBlock *txBlockx = dataBlock->m_superBlocks;
@ -102,11 +99,8 @@ void RemoteOutputSender::sendDataBlock(RemoteDataBlock *dataBlock)
{ {
if (m_udpSocket) if (m_udpSocket)
{ {
for (int i = 0; i < RemoteNbOrginalBlocks; i++) for (int i = 0; i < RemoteNbOrginalBlocks; i++) { // send block via UDP
{
// send block via UDP
m_udpSocket->writeDatagram((const char*)&txBlockx[i], (qint64 ) RemoteUdpSize, m_remoteHostAddress, dataPort); m_udpSocket->writeDatagram((const char*)&txBlockx[i], (qint64 ) RemoteUdpSize, m_remoteHostAddress, dataPort);
std::this_thread::sleep_for(std::chrono::microseconds(txDelay));
} }
} }
} }
@ -152,11 +146,8 @@ void RemoteOutputSender::sendDataBlock(RemoteDataBlock *dataBlock)
// Transmit all blocks // Transmit all blocks
if (m_udpSocket) if (m_udpSocket)
{ {
for (int i = 0; i < cm256Params.OriginalCount + cm256Params.RecoveryCount; i++) for (int i = 0; i < cm256Params.OriginalCount + cm256Params.RecoveryCount; i++) { // send block via UDP
{
// send block via UDP
m_udpSocket->writeDatagram((const char*)&txBlockx[i], (qint64 ) RemoteUdpSize, m_remoteHostAddress, dataPort); m_udpSocket->writeDatagram((const char*)&txBlockx[i], (qint64 ) RemoteUdpSize, m_remoteHostAddress, dataPort);
std::this_thread::sleep_for(std::chrono::microseconds(txDelay));
} }
} }
} }