mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-18 22:31:48 -05:00
SDRdaemonFEC support: debug (2). Fixed output meta data cature
This commit is contained in:
parent
46e85fa643
commit
96bec6cac3
@ -39,6 +39,7 @@ SDRdaemonFECBuffer::SDRdaemonFECBuffer(uint32_t throttlems) :
|
|||||||
m_bufferLenSec(0.0f)
|
m_bufferLenSec(0.0f)
|
||||||
{
|
{
|
||||||
m_currentMeta.init();
|
m_currentMeta.init();
|
||||||
|
m_outputMeta.init();
|
||||||
m_framesNbBytes = nbDecoderSlots * sizeof(BufferFrame) * m_iqSampleSize;
|
m_framesNbBytes = nbDecoderSlots * sizeof(BufferFrame) * m_iqSampleSize;
|
||||||
m_wrDeltaEstimate = m_framesNbBytes / 2;
|
m_wrDeltaEstimate = m_framesNbBytes / 2;
|
||||||
}
|
}
|
||||||
@ -82,6 +83,13 @@ void SDRdaemonFECBuffer::initDecodeSlot(int slotIndex)
|
|||||||
{
|
{
|
||||||
int pseudoWriteIndex = slotIndex * sizeof(BufferFrame);
|
int pseudoWriteIndex = slotIndex * sizeof(BufferFrame);
|
||||||
m_wrDeltaEstimate = pseudoWriteIndex - m_readIndex;
|
m_wrDeltaEstimate = pseudoWriteIndex - m_readIndex;
|
||||||
|
|
||||||
|
if (m_decoderSlots[slotIndex].m_blockZero.m_metaData.m_nbFECBlocks < 0) { // meta data invalid
|
||||||
|
m_outputMeta = m_currentMeta; // use current meta
|
||||||
|
} else {
|
||||||
|
m_outputMeta = m_decoderSlots[slotIndex].m_blockZero.m_metaData;
|
||||||
|
}
|
||||||
|
|
||||||
// collect stats before voiding the slot
|
// collect stats before voiding the slot
|
||||||
m_curNbBlocks = m_decoderSlots[slotIndex].m_blockCount;
|
m_curNbBlocks = m_decoderSlots[slotIndex].m_blockCount;
|
||||||
m_curNbRecovery = m_decoderSlots[slotIndex].m_recoveryCount;
|
m_curNbRecovery = m_decoderSlots[slotIndex].m_recoveryCount;
|
||||||
@ -205,6 +213,10 @@ void SDRdaemonFECBuffer::writeData(char *array, uint32_t length)
|
|||||||
{
|
{
|
||||||
int nbOriginalBlocks = m_decoderSlots[decoderIndex].m_blockCount - m_decoderSlots[decoderIndex].m_recoveryCount;
|
int nbOriginalBlocks = m_decoderSlots[decoderIndex].m_blockCount - m_decoderSlots[decoderIndex].m_recoveryCount;
|
||||||
|
|
||||||
|
qDebug() << "SDRdaemonFECBuffer::writeData:"
|
||||||
|
<< " nbOriginalBlocks: " << nbOriginalBlocks
|
||||||
|
<< " m_recoveryCount: " << m_decoderSlots[decoderIndex].m_recoveryCount;
|
||||||
|
|
||||||
for (int ir = 0; ir < m_decoderSlots[decoderIndex].m_recoveryCount; ir++) // recover lost blocks
|
for (int ir = 0; ir < m_decoderSlots[decoderIndex].m_recoveryCount; ir++) // recover lost blocks
|
||||||
{
|
{
|
||||||
int blockIndex = m_decoderSlots[decoderIndex].m_cm256DescriptorBlocks[nbOriginalBlocks+ir].Index;
|
int blockIndex = m_decoderSlots[decoderIndex].m_cm256DescriptorBlocks[nbOriginalBlocks+ir].Index;
|
||||||
@ -225,6 +237,8 @@ void SDRdaemonFECBuffer::writeData(char *array, uint32_t length)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//printMeta("SDRdaemonFECBuffer::writeData", &m_decoderSlots[decoderIndex].m_blockZero.m_metaData);
|
||||||
|
|
||||||
if (m_decoderSlots[decoderIndex].m_blockZero.m_metaData.m_nbFECBlocks >= 0) // meta data valid
|
if (m_decoderSlots[decoderIndex].m_blockZero.m_metaData.m_nbFECBlocks >= 0) // meta data valid
|
||||||
{
|
{
|
||||||
if (!(m_decoderSlots[decoderIndex].m_blockZero.m_metaData == m_currentMeta))
|
if (!(m_decoderSlots[decoderIndex].m_blockZero.m_metaData == m_currentMeta))
|
||||||
|
@ -67,7 +67,7 @@ SDRdaemonFECUDPHandler::~SDRdaemonFECUDPHandler()
|
|||||||
|
|
||||||
void SDRdaemonFECUDPHandler::start()
|
void SDRdaemonFECUDPHandler::start()
|
||||||
{
|
{
|
||||||
qDebug("SDRdaemonUDPHandler::start");
|
qDebug("SDRdaemonFECUDPHandler::start");
|
||||||
|
|
||||||
if (!m_dataSocket)
|
if (!m_dataSocket)
|
||||||
{
|
{
|
||||||
@ -78,13 +78,13 @@ void SDRdaemonFECUDPHandler::start()
|
|||||||
{
|
{
|
||||||
if (m_dataSocket->bind(m_dataAddress, m_dataPort))
|
if (m_dataSocket->bind(m_dataAddress, m_dataPort))
|
||||||
{
|
{
|
||||||
qDebug("SDRdaemonUDPHandler::start: bind data socket to %s:%d", m_dataAddress.toString().toStdString().c_str(), m_dataPort);
|
qDebug("SDRdaemonFECUDPHandler::start: bind data socket to %s:%d", m_dataAddress.toString().toStdString().c_str(), m_dataPort);
|
||||||
connect(m_dataSocket, SIGNAL(readyRead()), this, SLOT(dataReadyRead()), Qt::QueuedConnection); // , Qt::QueuedConnection
|
connect(m_dataSocket, SIGNAL(readyRead()), this, SLOT(dataReadyRead()), Qt::QueuedConnection); // , Qt::QueuedConnection
|
||||||
m_dataConnected = true;
|
m_dataConnected = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning("SDRdaemonUDPHandler::start: cannot bind data port %d", m_dataPort);
|
qWarning("SDRdaemonFECUDPHandler::start: cannot bind data port %d", m_dataPort);
|
||||||
m_dataConnected = false;
|
m_dataConnected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ void SDRdaemonFECUDPHandler::start()
|
|||||||
|
|
||||||
void SDRdaemonFECUDPHandler::stop()
|
void SDRdaemonFECUDPHandler::stop()
|
||||||
{
|
{
|
||||||
qDebug("SDRdaemonUDPHandler::stop");
|
qDebug("SDRdaemonFECUDPHandler::stop");
|
||||||
|
|
||||||
if (m_dataConnected) {
|
if (m_dataConnected) {
|
||||||
disconnect(m_dataSocket, SIGNAL(readyRead()), this, SLOT(dataReadyRead()));
|
disconnect(m_dataSocket, SIGNAL(readyRead()), this, SLOT(dataReadyRead()));
|
||||||
@ -113,12 +113,12 @@ void SDRdaemonFECUDPHandler::stop()
|
|||||||
|
|
||||||
void SDRdaemonFECUDPHandler::configureUDPLink(const QString& address, quint16 port)
|
void SDRdaemonFECUDPHandler::configureUDPLink(const QString& address, quint16 port)
|
||||||
{
|
{
|
||||||
qDebug("SDRdaemonUDPHandler::configureUDPLink: %s:%d", address.toStdString().c_str(), port);
|
qDebug("SDRdaemonFECUDPHandler::configureUDPLink: %s:%d", address.toStdString().c_str(), port);
|
||||||
bool addressOK = m_dataAddress.setAddress(address);
|
bool addressOK = m_dataAddress.setAddress(address);
|
||||||
|
|
||||||
if (!addressOK)
|
if (!addressOK)
|
||||||
{
|
{
|
||||||
qWarning("SDRdaemonUDPHandler::configureUDPLink: invalid address %s. Set to localhost.", address.toStdString().c_str());
|
qWarning("SDRdaemonFECUDPHandler::configureUDPLink: invalid address %s. Set to localhost.", address.toStdString().c_str());
|
||||||
m_dataAddress = QHostAddress::LocalHost;
|
m_dataAddress = QHostAddress::LocalHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,9 +134,6 @@ void SDRdaemonFECUDPHandler::dataReadyRead()
|
|||||||
qint64 pendingDataSize = m_dataSocket->pendingDatagramSize();
|
qint64 pendingDataSize = m_dataSocket->pendingDatagramSize();
|
||||||
m_udpReadBytes = m_dataSocket->readDatagram(m_udpBuf, pendingDataSize, &m_remoteAddress, 0);
|
m_udpReadBytes = m_dataSocket->readDatagram(m_udpBuf, pendingDataSize, &m_remoteAddress, 0);
|
||||||
|
|
||||||
qDebug() << "SDRdaemonUDPHandler::dataReadyRead:"
|
|
||||||
<< " m_udpReadBytes: " << m_udpReadBytes;
|
|
||||||
|
|
||||||
if (m_udpReadBytes == SDRdaemonFECBuffer::m_udpPayloadSize) {
|
if (m_udpReadBytes == SDRdaemonFECBuffer::m_udpPayloadSize) {
|
||||||
processData();
|
processData();
|
||||||
}
|
}
|
||||||
@ -152,10 +149,6 @@ void SDRdaemonFECUDPHandler::processData()
|
|||||||
m_tv_sec = metaData.m_tv_sec;
|
m_tv_sec = metaData.m_tv_sec;
|
||||||
m_tv_usec = metaData.m_tv_usec;
|
m_tv_usec = metaData.m_tv_usec;
|
||||||
|
|
||||||
qDebug() << "SDRdaemonUDPHandler::processData:"
|
|
||||||
<< " m_samplerate: " << metaData.m_sampleRate
|
|
||||||
<< " m_centerFrequency: " << metaData.m_centerFrequency;
|
|
||||||
|
|
||||||
if (m_centerFrequency != metaData.m_centerFrequency)
|
if (m_centerFrequency != metaData.m_centerFrequency)
|
||||||
{
|
{
|
||||||
m_centerFrequency = metaData.m_centerFrequency;
|
m_centerFrequency = metaData.m_centerFrequency;
|
||||||
@ -183,7 +176,7 @@ void SDRdaemonFECUDPHandler::processData()
|
|||||||
|
|
||||||
void SDRdaemonFECUDPHandler::connectTimer(const QTimer* timer)
|
void SDRdaemonFECUDPHandler::connectTimer(const QTimer* timer)
|
||||||
{
|
{
|
||||||
qDebug() << "SDRdaemonUDPHandler::connectTimer";
|
qDebug() << "SDRdaemonFECUDPHandler::connectTimer";
|
||||||
#ifdef USE_INTERNAL_TIMER
|
#ifdef USE_INTERNAL_TIMER
|
||||||
#warning "Uses internal timer"
|
#warning "Uses internal timer"
|
||||||
m_timer = new QTimer();
|
m_timer = new QTimer();
|
||||||
@ -226,7 +219,7 @@ void SDRdaemonFECUDPHandler::tick()
|
|||||||
m_tv_usec,
|
m_tv_usec,
|
||||||
m_sdrDaemonBuffer.getBufferLengthInSecs(),
|
m_sdrDaemonBuffer.getBufferLengthInSecs(),
|
||||||
m_sdrDaemonBuffer.getBufferGauge(),
|
m_sdrDaemonBuffer.getBufferGauge(),
|
||||||
m_sdrDaemonBuffer.getCurNbBlocks() == SDRdaemonFECBuffer::m_nbOriginalBlocks,
|
SDRdaemonFECBuffer::m_nbOriginalBlocks,
|
||||||
m_sdrDaemonBuffer.getCurNbBlocks(),
|
m_sdrDaemonBuffer.getCurNbBlocks(),
|
||||||
m_sdrDaemonBuffer.getCurNbRecovery(),
|
m_sdrDaemonBuffer.getCurNbRecovery(),
|
||||||
m_sdrDaemonBuffer.getAvgNbBlocks(),
|
m_sdrDaemonBuffer.getAvgNbBlocks(),
|
||||||
|
Loading…
Reference in New Issue
Block a user