22 #include <boost/crc.hpp> 23 #include <boost/cstdint.hpp> 41 m_remoteAddress(
"127.0.0.1"),
81 int samplesPerBlock = RemoteNbBytesPerBlock / (
SDR_RX_SAMP_SZ <= 16 ? 4 : 8);
84 qDebug() <<
"UDPSinkFEC::setTxDelay: txDelay: " << txDelayRatio <<
" m_txDelay: " <<
m_txDelay <<
" us";
89 qDebug() <<
"UDPSinkFEC::setNbBlocksFEC: nbBlocksFEC: " << nbBlocksFEC;
96 qDebug() <<
"UDPSinkFEC::setSampleRate: sampleRate: " << sampleRate;
103 qDebug() <<
"UDPSinkFEC::setRemoteAddress: address: " << address <<
" port: " << port;
114 const SampleVector::iterator end = begin + sampleChunkSize;
115 SampleVector::iterator it = begin;
119 int inRemainingSamples = end - it;
133 metaData.
m_tv_sec = ts_usecs / 1000000UL;
134 metaData.
m_tv_usec = ts_usecs % 1000000UL;
136 boost::crc_32_type
crc32;
139 metaData.
m_crc32 = crc32.checksum();
141 memset((
char *) &
m_superBlock, 0,
sizeof(m_superBlock));
145 m_superBlock.m_header.m_sampleBytes = (
SDR_RX_SAMP_SZ <= 16 ? 2 : 4);
149 *destMeta = metaData;
153 qDebug() <<
"UDPSinkFEC::write: meta: " 171 int samplesPerBlock = RemoteNbBytesPerBlock / (
SDR_RX_SAMP_SZ <= 16 ? 4 : 8);
176 (
const char *) &(*it),
177 inRemainingSamples *
sizeof(
Sample));
184 (
const char *) &(*it),
uint32_t m_sampleRate
sample rate in Hz
void setTxDelay(float txDelayRatio)
void pushTxFrame(RemoteSuperBlock *txBlocks, uint32_t nbBlocksFEC, uint32_t txDelay, uint16_t frameIndex)
int m_txBlocksIndex
Current index of Tx blocks row.
void setRemoteAddress(const QString &address, uint16_t port)
int m_sampleIndex
Current sample index in protected block data.
uint32_t m_txDelay
Delay in microseconds (usleep) between each sending of an UDP datagram.
RemoteProtectedBlock m_protectedBlock
void write(const SampleVector::iterator &begin, uint32_t sampleChunkSize)
float m_txDelayRatio
Delay in ratio of nominal frame period.
void startStop(bool start)
RemoteMetaDataFEC m_currentMetaFEC
Meta data for current frame.
uint8_t buf[RemoteNbBytesPerBlock]
RemoteSuperBlock m_txBlocks[4][256]
UDP blocks to send with original data + FEC.
static const uint32_t m_nbOriginalBlocks
Number of original blocks in a protected block sequence.
RemoteSuperBlock m_superBlock
current super block being built
static const uint32_t m_udpSize
Size of UDP block in number of bytes.
UDPSinkFECWorker * m_udpWorker
void setRemoteAddress(const QString &address, uint16_t port)
static uint64_t nowus()
returns the current epoch in microseconds
int m_txBlockIndex
Current index in blocks to transmit in the Tx row.
void setNbBlocksFEC(uint32_t nbBlocksFEC)
uint32_t crc32(const uint8_t *buf, int len)
uint16_t m_frameCount
transmission frame count
void setSampleRate(uint32_t sampleRate)
uint32_t m_nbBlocksFEC
Variable number of FEC blocks.
unsigned __int64 uint64_t