2016-01-24 17:38:55 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2016 Edouard Griffiths, F4EXB //
|
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2016-03-15 01:13:52 -04:00
|
|
|
#include "sdrdaemonbuffer.h"
|
|
|
|
|
|
|
|
#include <QDebug>
|
2016-01-24 17:38:55 -05:00
|
|
|
#include <cassert>
|
|
|
|
#include <cstring>
|
2016-03-15 01:13:52 -04:00
|
|
|
#include <lz4.h>
|
|
|
|
|
2016-01-24 17:38:55 -05:00
|
|
|
|
2016-02-19 21:41:20 -05:00
|
|
|
const int SDRdaemonBuffer::m_udpPayloadSize = 512;
|
|
|
|
const int SDRdaemonBuffer::m_sampleSize = 2;
|
|
|
|
const int SDRdaemonBuffer::m_iqSampleSize = 2 * m_sampleSize;
|
2016-03-16 00:51:22 -04:00
|
|
|
const int SDRdaemonBuffer::m_rawBufferLengthSeconds = 8; // should be even
|
2016-02-19 21:41:20 -05:00
|
|
|
|
2016-03-15 01:13:52 -04:00
|
|
|
SDRdaemonBuffer::SDRdaemonBuffer(uint32_t throttlems) :
|
|
|
|
m_throttlemsNominal(throttlems),
|
|
|
|
m_rawSize(0),
|
|
|
|
m_rawBuffer(0),
|
|
|
|
m_sampleRateStream(0),
|
|
|
|
m_sampleRate(0),
|
|
|
|
m_sampleBytes(2),
|
|
|
|
m_sampleBits(12),
|
2016-01-24 17:38:55 -05:00
|
|
|
m_sync(false),
|
2016-02-21 05:01:43 -05:00
|
|
|
m_syncLock(false),
|
2016-01-24 17:38:55 -05:00
|
|
|
m_lz4(false),
|
2016-03-15 01:13:52 -04:00
|
|
|
m_nbBlocks(0),
|
|
|
|
m_bytesInBlock(0),
|
|
|
|
m_dataCRC(0),
|
2016-01-27 22:54:16 -05:00
|
|
|
m_inCount(0),
|
2016-01-24 17:38:55 -05:00
|
|
|
m_lz4InCount(0),
|
|
|
|
m_lz4InSize(0),
|
2016-03-15 01:13:52 -04:00
|
|
|
m_lz4InBuffer(0),
|
2016-01-24 17:38:55 -05:00
|
|
|
m_lz4OutBuffer(0),
|
2016-01-27 02:24:00 -05:00
|
|
|
m_frameSize(0),
|
2016-02-20 17:02:34 -05:00
|
|
|
m_nbLz4Decodes(0),
|
|
|
|
m_nbLz4SuccessfulDecodes(0),
|
|
|
|
m_nbLz4CRCOK(0),
|
2016-02-23 13:27:47 -05:00
|
|
|
m_nbLastLz4SuccessfulDecodes(0),
|
|
|
|
m_nbLastLz4CRCOK(0),
|
2016-02-19 21:41:20 -05:00
|
|
|
m_writeIndex(0),
|
2016-03-15 01:13:52 -04:00
|
|
|
m_readIndex(0),
|
|
|
|
m_readSize(0),
|
|
|
|
m_readBuffer(0),
|
2016-03-15 13:56:15 -04:00
|
|
|
m_autoFollowRate(false),
|
|
|
|
m_skewTest(false),
|
|
|
|
m_skewCorrection(false),
|
|
|
|
m_readCount(0),
|
2016-03-16 04:10:29 -04:00
|
|
|
m_writeCount(0),
|
2016-03-17 10:41:48 -04:00
|
|
|
m_nbCycles(0)
|
2016-01-24 17:38:55 -05:00
|
|
|
{
|
|
|
|
m_currentMeta.init();
|
|
|
|
}
|
|
|
|
|
|
|
|
SDRdaemonBuffer::~SDRdaemonBuffer()
|
|
|
|
{
|
2016-01-26 02:27:45 -05:00
|
|
|
if (m_rawBuffer) {
|
|
|
|
delete[] m_rawBuffer;
|
|
|
|
}
|
|
|
|
|
2016-01-27 02:24:00 -05:00
|
|
|
if (m_lz4InBuffer) {
|
|
|
|
delete[] m_lz4InBuffer;
|
|
|
|
}
|
2016-01-27 22:54:16 -05:00
|
|
|
|
|
|
|
if (m_lz4OutBuffer) {
|
|
|
|
delete[] m_lz4OutBuffer;
|
|
|
|
}
|
2016-03-15 01:13:52 -04:00
|
|
|
|
|
|
|
if (m_readBuffer) {
|
|
|
|
delete[] m_readBuffer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRdaemonBuffer::updateBufferSize(uint32_t sampleRate)
|
|
|
|
{
|
|
|
|
uint32_t rawSize = sampleRate * m_iqSampleSize * m_rawBufferLengthSeconds; // store worth of this seconds of samples at this sample rate
|
|
|
|
|
|
|
|
if (rawSize != m_rawSize)
|
|
|
|
{
|
|
|
|
m_rawSize = rawSize;
|
|
|
|
|
|
|
|
if (m_rawBuffer) {
|
|
|
|
delete[] m_rawBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_rawBuffer = new uint8_t[m_rawSize];
|
2016-03-15 13:56:15 -04:00
|
|
|
resetIndexes();
|
2016-03-15 01:13:52 -04:00
|
|
|
|
|
|
|
qDebug() << "SDRdaemonBuffer::updateBufferSize:"
|
|
|
|
<< " sampleRate: " << sampleRate
|
|
|
|
<< " m_rawSize: " << m_rawSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRdaemonBuffer::updateLZ4Sizes(uint32_t frameSize)
|
|
|
|
{
|
|
|
|
uint32_t maxInputSize = LZ4_compressBound(frameSize);
|
|
|
|
|
|
|
|
if (m_lz4InBuffer) {
|
|
|
|
delete[] m_lz4InBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_lz4InBuffer = new uint8_t[maxInputSize];
|
|
|
|
|
|
|
|
if (m_lz4OutBuffer) {
|
|
|
|
delete[] m_lz4OutBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_lz4OutBuffer = new uint8_t[frameSize];
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRdaemonBuffer::updateReadBufferSize(uint32_t length)
|
|
|
|
{
|
|
|
|
if (m_readBuffer) {
|
|
|
|
delete[] m_readBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_readBuffer = new uint8_t[length];
|
2016-01-24 17:38:55 -05:00
|
|
|
}
|
|
|
|
|
2016-01-27 22:54:16 -05:00
|
|
|
bool SDRdaemonBuffer::readMeta(char *array, uint32_t length)
|
2016-01-24 17:38:55 -05:00
|
|
|
{
|
2016-01-26 17:48:52 -05:00
|
|
|
assert(length >= sizeof(MetaData) + 8);
|
2016-01-24 17:38:55 -05:00
|
|
|
MetaData *metaData = (MetaData *) array;
|
|
|
|
|
2016-03-15 01:13:52 -04:00
|
|
|
if (m_crc64.calculate_crc((uint8_t *) array, sizeof(MetaData) - 8) == metaData->m_crc)
|
2016-01-24 17:38:55 -05:00
|
|
|
{
|
2016-02-21 05:01:43 -05:00
|
|
|
// sync condition:
|
|
|
|
if (m_currentMeta.m_blockSize > 0)
|
|
|
|
{
|
|
|
|
uint32_t nbBlocks = m_currentMeta.m_nbBytes / m_currentMeta.m_blockSize;
|
|
|
|
m_syncLock = nbBlocks + (m_lz4 ? 2 : 1) == m_nbBlocks;
|
|
|
|
//qDebug("SDRdaemonBuffer::readMeta: m_nbBlocks: %d:%d %s", nbBlocks, m_nbBlocks, (m_syncLock ? "locked" : "unlocked"));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_syncLock = false;
|
|
|
|
}
|
|
|
|
|
2016-01-24 17:38:55 -05:00
|
|
|
memcpy((void *) &m_dataCRC, (const void *) &array[sizeof(MetaData)], 8);
|
2016-01-27 21:30:36 -05:00
|
|
|
m_nbBlocks = 0;
|
2016-01-27 22:54:16 -05:00
|
|
|
m_inCount = 0;
|
2016-01-24 17:38:55 -05:00
|
|
|
|
2016-02-22 19:29:03 -05:00
|
|
|
if (!m_lz4 && !(m_currentMeta == *metaData))
|
2016-01-24 17:38:55 -05:00
|
|
|
{
|
2016-03-15 01:13:52 -04:00
|
|
|
printMeta(QString("SDRdaemonBuffer::readMeta"), metaData);
|
2016-01-24 17:38:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
m_currentMeta = *metaData;
|
|
|
|
|
|
|
|
// sanity checks
|
2016-02-19 21:41:20 -05:00
|
|
|
if (metaData->m_blockSize == m_udpPayloadSize) // sent blocksize matches given blocksize
|
2016-01-24 17:38:55 -05:00
|
|
|
{
|
2016-01-27 22:54:16 -05:00
|
|
|
m_sampleBytes = metaData->m_sampleBytes & 0x0F;
|
2016-02-19 21:41:20 -05:00
|
|
|
uint32_t frameSize = m_iqSampleSize * metaData->m_nbSamples * metaData->m_nbBlocks;
|
2016-02-22 22:50:15 -05:00
|
|
|
int sampleRate = metaData->m_sampleRate;
|
2016-01-27 02:24:00 -05:00
|
|
|
|
2016-03-15 13:56:15 -04:00
|
|
|
if (sampleRate != m_sampleRateStream) // change of nominal stream sample rate
|
2016-02-22 08:18:41 -05:00
|
|
|
{
|
2016-03-15 01:13:52 -04:00
|
|
|
updateBufferSize(sampleRate);
|
2016-03-10 23:25:25 -05:00
|
|
|
m_sampleRateStream = sampleRate;
|
2016-03-15 01:13:52 -04:00
|
|
|
m_sampleRate = sampleRate;
|
2016-02-22 08:18:41 -05:00
|
|
|
}
|
2016-02-22 06:10:13 -05:00
|
|
|
|
2016-03-15 13:56:15 -04:00
|
|
|
// auto skew rate compensation
|
2016-03-15 16:22:12 -04:00
|
|
|
if (m_autoFollowRate)
|
2016-03-15 13:56:15 -04:00
|
|
|
{
|
2016-03-15 16:22:12 -04:00
|
|
|
if (m_skewCorrection)
|
|
|
|
{
|
2016-03-16 04:10:29 -04:00
|
|
|
int64_t deltaRate = (m_writeCount - m_readCount) / (m_nbCycles * m_rawBufferLengthSeconds * m_iqSampleSize);
|
|
|
|
m_sampleRate = ((m_sampleRate + deltaRate) / m_iqSampleSize) * m_iqSampleSize; // ensure it is a multiple of the I/Q sample size
|
2016-03-15 16:22:12 -04:00
|
|
|
resetIndexes();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_sampleRate = sampleRate;
|
2016-03-15 13:56:15 -04:00
|
|
|
}
|
|
|
|
|
2016-01-24 17:38:55 -05:00
|
|
|
if (metaData->m_sampleBytes & 0x10)
|
|
|
|
{
|
|
|
|
m_lz4 = true;
|
2016-01-27 02:24:00 -05:00
|
|
|
m_lz4InSize = metaData->m_nbBytes; // compressed input size
|
|
|
|
m_lz4InCount = 0;
|
|
|
|
|
|
|
|
if (frameSize != m_frameSize)
|
|
|
|
{
|
|
|
|
updateLZ4Sizes(frameSize);
|
|
|
|
}
|
2016-01-24 17:38:55 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_lz4 = false;
|
|
|
|
}
|
|
|
|
|
2016-01-27 02:24:00 -05:00
|
|
|
m_frameSize = frameSize;
|
2016-01-24 17:38:55 -05:00
|
|
|
m_sync = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_sync = false;
|
|
|
|
}
|
2016-01-26 17:48:52 -05:00
|
|
|
|
2016-02-17 02:40:10 -05:00
|
|
|
return m_sync;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2016-01-26 17:48:52 -05:00
|
|
|
}
|
|
|
|
|
2016-01-27 22:54:16 -05:00
|
|
|
void SDRdaemonBuffer::writeData(char *array, uint32_t length)
|
2016-01-26 17:48:52 -05:00
|
|
|
{
|
2016-01-27 22:54:16 -05:00
|
|
|
if ((m_sync) && (m_nbBlocks > 0))
|
2016-01-24 17:38:55 -05:00
|
|
|
{
|
2016-01-26 17:48:52 -05:00
|
|
|
if (m_lz4)
|
2016-01-24 17:38:55 -05:00
|
|
|
{
|
2016-01-26 17:48:52 -05:00
|
|
|
writeDataLZ4(array, length);
|
2016-01-24 17:38:55 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-02-17 13:42:26 -05:00
|
|
|
writeToRawBufferUncompressed(array, length);
|
2016-01-24 17:38:55 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-15 01:13:52 -04:00
|
|
|
uint8_t *SDRdaemonBuffer::readData(int32_t length)
|
|
|
|
{
|
2016-03-15 13:56:15 -04:00
|
|
|
if (m_skewTest && ((m_readIndex + length) > (m_rawSize / 2)))
|
|
|
|
{
|
|
|
|
int dIndex = (m_readIndex - m_writeIndex > 0 ? m_readIndex - m_writeIndex : m_writeIndex - m_readIndex); // absolute delta
|
|
|
|
m_skewCorrection = (dIndex < m_rawSize / 10); // close by 10%
|
2016-03-16 04:10:29 -04:00
|
|
|
m_nbCycles++;
|
2016-03-15 13:56:15 -04:00
|
|
|
m_skewTest = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_readCount += length;
|
|
|
|
|
2016-03-15 01:13:52 -04:00
|
|
|
if (m_readIndex + length < m_rawSize)
|
|
|
|
{
|
|
|
|
uint32_t readIndex = m_readIndex;
|
|
|
|
m_readIndex += length;
|
|
|
|
return &m_rawBuffer[readIndex];
|
|
|
|
}
|
|
|
|
else if (m_readIndex + length == m_rawSize)
|
|
|
|
{
|
|
|
|
uint32_t readIndex = m_readIndex;
|
|
|
|
m_readIndex = 0;
|
2016-03-15 13:56:15 -04:00
|
|
|
m_skewTest = true;
|
2016-03-15 01:13:52 -04:00
|
|
|
return &m_rawBuffer[readIndex];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// TODO: implement auto skew rate compensation calculation
|
|
|
|
|
|
|
|
if (length > m_readSize)
|
|
|
|
{
|
|
|
|
updateReadBufferSize(length);
|
|
|
|
m_readSize = length;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::memcpy((void *) m_readBuffer, (const void *) &m_rawBuffer[m_readIndex], m_rawSize - m_readIndex);
|
|
|
|
length -= m_rawSize - m_readIndex;
|
|
|
|
std::memcpy((void *) &m_readBuffer[m_rawSize - m_readIndex], (const void *) m_rawBuffer, length);
|
|
|
|
m_readIndex = length;
|
2016-03-15 13:56:15 -04:00
|
|
|
m_skewTest = true;
|
|
|
|
return m_readBuffer;
|
2016-03-15 01:13:52 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-27 22:54:16 -05:00
|
|
|
void SDRdaemonBuffer::writeDataLZ4(const char *array, uint32_t length)
|
2016-01-24 17:38:55 -05:00
|
|
|
{
|
|
|
|
if (m_lz4InCount + length < m_lz4InSize)
|
|
|
|
{
|
2016-01-27 02:40:54 -05:00
|
|
|
std::memcpy((void *) &m_lz4InBuffer[m_lz4InCount], (const void *) array, length);
|
2016-01-24 17:38:55 -05:00
|
|
|
m_lz4InCount += length;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::memcpy((void *) &m_lz4InBuffer[m_lz4InCount], (const void *) array, m_lz4InSize - m_lz4InCount); // copy rest of data in compressed Buffer
|
|
|
|
m_lz4InCount += length;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_lz4InCount >= m_lz4InSize) // full input compressed block retrieved
|
|
|
|
{
|
2016-02-20 17:02:34 -05:00
|
|
|
if (m_nbLz4Decodes == 100)
|
2016-01-24 17:38:55 -05:00
|
|
|
{
|
2016-03-15 01:13:52 -04:00
|
|
|
qDebug() << "SDRdaemonBuffer::writeAndReadLZ4:"
|
2016-02-20 17:02:34 -05:00
|
|
|
<< " decoding: " << m_nbLz4CRCOK
|
|
|
|
<< ":" << m_nbLz4SuccessfulDecodes
|
2016-03-15 01:13:52 -04:00
|
|
|
<< "/" << m_nbLz4Decodes;
|
2016-01-24 17:38:55 -05:00
|
|
|
|
2016-02-23 13:27:47 -05:00
|
|
|
m_nbLastLz4SuccessfulDecodes = m_nbLz4SuccessfulDecodes;
|
|
|
|
m_nbLastLz4CRCOK = m_nbLz4CRCOK;
|
2016-02-20 17:02:34 -05:00
|
|
|
m_nbLz4Decodes = 0;
|
|
|
|
m_nbLz4SuccessfulDecodes = 0;
|
|
|
|
m_nbLz4CRCOK = 0;
|
2016-01-24 17:38:55 -05:00
|
|
|
}
|
|
|
|
|
2016-02-22 19:29:03 -05:00
|
|
|
writeToRawBufferLZ4();
|
2016-01-24 17:38:55 -05:00
|
|
|
m_lz4InCount = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-22 19:29:03 -05:00
|
|
|
void SDRdaemonBuffer::writeToRawBufferLZ4()
|
2016-01-27 22:54:16 -05:00
|
|
|
{
|
2016-02-22 19:29:03 -05:00
|
|
|
uint64_t crc64 = m_crc64.calculate_crc(m_lz4InBuffer, m_lz4InSize);
|
|
|
|
|
|
|
|
if (memcmp(&crc64, &m_dataCRC, 8) == 0)
|
|
|
|
{
|
|
|
|
m_nbLz4CRCOK++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-01-27 22:54:16 -05:00
|
|
|
int compressedSize = LZ4_decompress_fast((const char*) m_lz4InBuffer, (char*) m_lz4OutBuffer, m_frameSize);
|
2016-02-20 17:02:34 -05:00
|
|
|
m_nbLz4Decodes++;
|
2016-01-27 22:54:16 -05:00
|
|
|
|
|
|
|
if (compressedSize == m_lz4InSize)
|
|
|
|
{
|
2016-02-20 17:02:34 -05:00
|
|
|
m_nbLz4SuccessfulDecodes++;
|
2016-02-22 19:29:03 -05:00
|
|
|
writeToRawBufferUncompressed((const char *) m_lz4OutBuffer, m_frameSize);
|
2016-01-27 22:54:16 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-15 01:13:52 -04:00
|
|
|
void SDRdaemonBuffer::writeToRawBufferUncompressed(const char *array, uint32_t length)
|
2016-01-29 02:17:34 -05:00
|
|
|
{
|
2016-03-15 01:13:52 -04:00
|
|
|
// TODO: handle the 1 byte per I or Q sample
|
|
|
|
if (m_writeIndex + length < m_rawSize)
|
2016-01-29 02:17:34 -05:00
|
|
|
{
|
2016-03-15 01:13:52 -04:00
|
|
|
std::memcpy((void *) &m_rawBuffer[m_writeIndex], (const void *) array, length);
|
|
|
|
m_writeIndex += length;
|
2016-01-27 02:24:00 -05:00
|
|
|
}
|
2016-03-15 01:13:52 -04:00
|
|
|
else if (m_writeIndex + length == m_rawSize)
|
|
|
|
{
|
|
|
|
std::memcpy((void *) &m_rawBuffer[m_writeIndex], (const void *) array, length);
|
|
|
|
m_writeIndex = 0;
|
2016-01-24 17:38:55 -05:00
|
|
|
}
|
2016-03-15 01:13:52 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
std::memcpy((void *) &m_rawBuffer[m_writeIndex], (const void *) array, m_rawSize - m_writeIndex);
|
|
|
|
length -= m_rawSize - m_writeIndex;
|
|
|
|
std::memcpy((void *) m_rawBuffer, (const void *) &array[m_rawSize - m_writeIndex], length);
|
|
|
|
m_writeIndex = length;
|
2016-01-26 02:27:45 -05:00
|
|
|
}
|
2016-03-15 13:56:15 -04:00
|
|
|
|
|
|
|
m_writeCount += length;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SDRdaemonBuffer::resetIndexes()
|
|
|
|
{
|
|
|
|
m_writeIndex = 0;
|
|
|
|
m_readIndex = m_rawSize / 2;
|
|
|
|
m_readCount = 0;
|
|
|
|
m_writeCount = 0;
|
2016-03-16 04:10:29 -04:00
|
|
|
m_nbCycles = 0;
|
2016-03-15 13:56:15 -04:00
|
|
|
m_skewTest = false;
|
|
|
|
m_skewCorrection = false;
|
2016-01-26 02:27:45 -05:00
|
|
|
}
|
2016-01-24 17:38:55 -05:00
|
|
|
|
2016-01-27 21:30:36 -05:00
|
|
|
void SDRdaemonBuffer::updateBlockCounts(uint32_t nbBytesReceived)
|
|
|
|
{
|
2016-02-19 21:41:20 -05:00
|
|
|
m_nbBlocks += m_bytesInBlock + nbBytesReceived > m_udpPayloadSize ? 1 : 0;
|
|
|
|
m_bytesInBlock = m_bytesInBlock + nbBytesReceived > m_udpPayloadSize ? nbBytesReceived : m_bytesInBlock + nbBytesReceived;
|
2016-01-27 21:30:36 -05:00
|
|
|
}
|
|
|
|
|
2016-03-15 01:13:52 -04:00
|
|
|
void SDRdaemonBuffer::printMeta(const QString& header, MetaData *metaData)
|
2016-01-24 17:38:55 -05:00
|
|
|
{
|
2016-03-15 01:13:52 -04:00
|
|
|
qDebug() << header << ": "
|
|
|
|
<< "|" << metaData->m_centerFrequency
|
|
|
|
<< ":" << metaData->m_sampleRate
|
|
|
|
<< ":" << (int) (metaData->m_sampleBytes & 0xF)
|
|
|
|
<< ":" << (int) metaData->m_sampleBits
|
|
|
|
<< ":" << metaData->m_blockSize
|
|
|
|
<< ":" << metaData->m_nbSamples
|
|
|
|
<< "||" << metaData->m_nbBlocks
|
|
|
|
<< ":" << metaData->m_nbBytes
|
|
|
|
<< "|" << metaData->m_tv_sec
|
|
|
|
<< ":" << metaData->m_tv_usec;
|
2016-01-24 17:38:55 -05:00
|
|
|
}
|
|
|
|
|