DaemonSink (6)

This commit is contained in:
f4exb 2018-09-06 04:36:56 +02:00
parent 354409a21a
commit 2be1281885
7 changed files with 19 additions and 20 deletions

View File

@ -54,7 +54,7 @@ DaemonSink::DaemonSink(DeviceSourceAPI *deviceAPI) :
m_sampleRate(48000),
m_sampleBytes(SDR_RX_SAMP_SZ == 24 ? 4 : 2),
m_nbBlocksFEC(0),
m_txDelay(50),
m_txDelay(35),
m_dataAddress("127.0.0.1"),
m_dataPort(9090)
{
@ -64,8 +64,6 @@ DaemonSink::DaemonSink(DeviceSourceAPI *deviceAPI) :
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
m_deviceAPI->addThreadedSink(m_threadedChannelizer);
m_deviceAPI->addChannelAPI(this);
m_cm256p = m_cm256.isInitialized() ? &m_cm256 : 0;
}
DaemonSink::~DaemonSink()
@ -212,7 +210,7 @@ void DaemonSink::start()
stop();
}
m_sinkThread = new DaemonSinkThread(&m_dataQueue, m_cm256p);
m_sinkThread = new DaemonSinkThread(&m_dataQueue);
m_sinkThread->startStop(true);
m_running = true;
}
@ -366,7 +364,7 @@ int DaemonSink::webapiSettingsPutPatch(
int txDelay = response.getDaemonSinkSettings()->getTxDelay();
if (txDelay < 0) {
settings.m_txDelay = 50;
settings.m_txDelay = 35;
} else {
settings.m_txDelay = txDelay;
}

View File

@ -26,8 +26,6 @@
#include <QObject>
#include <QMutex>
#include "cm256.h"
#include "dsp/basebandsamplesink.h"
#include "channel/channelsinkapi.h"
#include "channel/sdrdaemondataqueue.h"
@ -134,8 +132,6 @@ private:
DaemonSinkSettings m_settings;
SDRDaemonDataQueue m_dataQueue;
DaemonSinkThread *m_sinkThread;
CM256 m_cm256;
CM256 *m_cm256p;
int m_txBlockIndex; //!< Current index in blocks to transmit in the Tx row
uint16_t m_frameCount; //!< transmission frame count

View File

@ -179,6 +179,7 @@ void DaemonSinkGUI::displaySettings()
QString s1 = QString::number(m_settings.m_nbFECBlocks, 'f', 0);
ui->nominalNbBlocksText->setText(tr("%1/%2").arg(s).arg(s1));
ui->txDelayText->setText(tr("%1%").arg(m_settings.m_txDelay));
ui->txDelay->setValue(m_settings.m_txDelay);
updateTxDelayTime();
blockApplySettings(false);
}

View File

@ -232,16 +232,16 @@
<string>Delay between consecutive UDP packets in percentage of nominal UDP packet process time</string>
</property>
<property name="minimum">
<number>10</number>
<number>0</number>
</property>
<property name="maximum">
<number>90</number>
<number>70</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>50</number>
<number>35</number>
</property>
</widget>
</item>

View File

@ -34,7 +34,7 @@ DaemonSinkSettings::DaemonSinkSettings()
void DaemonSinkSettings::resetToDefaults()
{
m_nbFECBlocks = 0;
m_txDelay = 50;
m_txDelay = 35;
m_dataAddress = "127.0.0.1";
m_dataPort = 9090;
m_rgbColor = QColor(140, 4, 4).rgb();
@ -77,7 +77,7 @@ bool DaemonSinkSettings::deserialize(const QByteArray& data)
m_nbFECBlocks = 0;
}
d.readU32(2, &m_txDelay, 50);
d.readU32(2, &m_txDelay, 35);
d.readString(3, &m_dataAddress, "127.0.0.1");
d.readU32(4, &tmp, 0);

View File

@ -30,14 +30,15 @@
MESSAGE_CLASS_DEFINITION(DaemonSinkThread::MsgStartStop, Message)
DaemonSinkThread::DaemonSinkThread(SDRDaemonDataQueue *dataQueue, CM256 *cm256, QObject* parent) :
DaemonSinkThread::DaemonSinkThread(SDRDaemonDataQueue *dataQueue, QObject* parent) :
QThread(parent),
m_running(false),
m_dataQueue(dataQueue),
m_cm256(cm256),
m_address(QHostAddress::LocalHost),
m_socket(0)
{
m_cm256p = m_cm256.isInitialized() ? &m_cm256 : 0;
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
connect(m_dataQueue, SIGNAL(dataBlockEnqueued()), this, SLOT(handleData()), Qt::QueuedConnection);
}
@ -102,7 +103,7 @@ bool DaemonSinkThread::handleDataBlock(SDRDaemonDataBlock& dataBlock)
uint16_t dataPort = dataBlock.m_txControlBlock.m_dataPort;
SDRDaemonSuperBlock *txBlockx = dataBlock.m_superBlocks;
if ((nbBlocksFEC == 0) || !m_cm256) // Do not FEC encode
if ((nbBlocksFEC == 0) || !m_cm256p) // Do not FEC encode
{
if (m_socket)
{
@ -134,7 +135,7 @@ bool DaemonSinkThread::handleDataBlock(SDRDaemonDataBlock& dataBlock)
}
// Encode FEC blocks
if (m_cm256->cm256_encode(cm256Params, descriptorBlocks, fecBlocks))
if (m_cm256p->cm256_encode(cm256Params, descriptorBlocks, fecBlocks))
{
qWarning("SDRDaemonChannelSinkThread::handleDataBlock: CM256 encode failed. No transmission.");
// TODO: send without FEC changing meta data to set indication of no FEC

View File

@ -25,6 +25,8 @@
#include <QWaitCondition>
#include <QHostAddress>
#include "cm256.h"
#include "util/message.h"
#include "util/messagequeue.h"
@ -56,7 +58,7 @@ public:
{ }
};
DaemonSinkThread(SDRDaemonDataQueue *dataQueue, CM256 *cm256, QObject* parent = 0);
DaemonSinkThread(SDRDaemonDataQueue *dataQueue, QObject* parent = 0);
~DaemonSinkThread();
void startStop(bool start);
@ -67,7 +69,8 @@ private:
bool m_running;
SDRDaemonDataQueue *m_dataQueue;
CM256 *m_cm256; //!< CM256 library object
CM256 m_cm256;
CM256 *m_cm256p;
QHostAddress m_address;
QUdpSocket *m_socket;