1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -05:00

DaemonSink: finalization and cleanup

This commit is contained in:
f4exb 2018-09-06 05:39:28 +02:00
parent 3b09e0e5d7
commit b839b5d0c3
4 changed files with 3 additions and 25 deletions

View File

@ -184,9 +184,7 @@ void DaemonSink::feed(const SampleVector::const_iterator& begin, const SampleVec
m_dataBlock->m_txControlBlock.m_dataAddress = m_dataAddress;
m_dataBlock->m_txControlBlock.m_dataPort = m_dataPort;
//qDebug("DaemonSink::feed: m_dataBlock: %p m_dataQueue.sz: %d", m_dataBlock, m_dataQueue.size());
emit dataBlockAvailable(m_dataBlock);
//m_dataQueue.push(m_dataBlock);
m_dataBlock = new SDRDaemonDataBlock(); // create a new one immediately
m_dataBlockMutex.unlock();
@ -211,7 +209,7 @@ void DaemonSink::start()
stop();
}
m_sinkThread = new DaemonSinkThread(&m_dataQueue);
m_sinkThread = new DaemonSinkThread();
connect(this,
SIGNAL(dataBlockAvailable(SDRDaemonDataBlock *)),
m_sinkThread,

View File

@ -28,7 +28,6 @@
#include "dsp/basebandsamplesink.h"
#include "channel/channelsinkapi.h"
#include "channel/sdrdaemondataqueue.h"
#include "channel/sdrdaemondatablock.h"
#include "daemonsinksettings.h"
@ -133,7 +132,6 @@ private:
bool m_running;
DaemonSinkSettings m_settings;
SDRDaemonDataQueue m_dataQueue;
DaemonSinkThread *m_sinkThread;
int m_txBlockIndex; //!< Current index in blocks to transmit in the Tx row

View File

@ -22,7 +22,6 @@
#include <QUdpSocket>
#include "channel/sdrdaemondataqueue.h"
#include "channel/sdrdaemondatablock.h"
#include "daemonsinkthread.h"
@ -30,17 +29,15 @@
MESSAGE_CLASS_DEFINITION(DaemonSinkThread::MsgStartStop, Message)
DaemonSinkThread::DaemonSinkThread(SDRDaemonDataQueue *dataQueue, QObject* parent) :
DaemonSinkThread::DaemonSinkThread(QObject* parent) :
QThread(parent),
m_running(false),
m_dataQueue(dataQueue),
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);
}
DaemonSinkThread::~DaemonSinkThread()
@ -104,7 +101,6 @@ void DaemonSinkThread::handleDataBlock(SDRDaemonDataBlock& dataBlock)
uint16_t frameIndex = dataBlock.m_txControlBlock.m_frameIndex;
int nbBlocksFEC = dataBlock.m_txControlBlock.m_nbBlocksFEC;
int txDelay = dataBlock.m_txControlBlock.m_txDelay;
//qDebug("DaemonSinkThread::handleDataBlock: dataBlock: %p QS: %d", &dataBlock, m_dataQueue->size());
m_address.setAddress(dataBlock.m_txControlBlock.m_dataAddress);
uint16_t dataPort = dataBlock.m_txControlBlock.m_dataPort;
SDRDaemonSuperBlock *txBlockx = dataBlock.m_superBlocks;
@ -168,17 +164,6 @@ void DaemonSinkThread::handleDataBlock(SDRDaemonDataBlock& dataBlock)
dataBlock.m_txControlBlock.m_processed = true;
}
void DaemonSinkThread::handleData()
{
SDRDaemonDataBlock* dataBlock;
while (m_running && ((dataBlock = m_dataQueue->pop()) != 0))
{
handleDataBlock(*dataBlock);
delete dataBlock;
}
}
void DaemonSinkThread::handleInputMessages()
{
Message* message;

View File

@ -30,7 +30,6 @@
#include "util/message.h"
#include "util/messagequeue.h"
class SDRDaemonDataQueue;
class SDRDaemonDataBlock;
class CM256;
class QUdpSocket;
@ -58,7 +57,7 @@ public:
{ }
};
DaemonSinkThread(SDRDaemonDataQueue *dataQueue, QObject* parent = 0);
DaemonSinkThread(QObject* parent = 0);
~DaemonSinkThread();
void startStop(bool start);
@ -71,7 +70,6 @@ private:
QWaitCondition m_startWaiter;
bool m_running;
SDRDaemonDataQueue *m_dataQueue;
CM256 m_cm256;
CM256 *m_cm256p;
@ -87,6 +85,5 @@ private:
void handleDataBlock(SDRDaemonDataBlock& dataBlock);
private slots:
void handleData();
void handleInputMessages();
};