mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-18 14:21:49 -05:00
SDRdaemon: fixed core dump
This commit is contained in:
parent
157a77835e
commit
84178789e4
@ -110,13 +110,15 @@ void SDRDaemonChannelSink::feed(const SampleVector::const_iterator& begin, const
|
||||
metaData.m_tv_sec = tv.tv_sec;
|
||||
metaData.m_tv_usec = tv.tv_usec;
|
||||
|
||||
if (!m_dataBlock) { // on the very first cycle there is no data block allocated
|
||||
m_dataBlock = new SDRDaemonDataBlock();
|
||||
}
|
||||
|
||||
boost::crc_32_type crc32;
|
||||
crc32.process_bytes(&metaData, 20);
|
||||
metaData.m_crc32 = crc32.checksum();
|
||||
SDRDaemonSuperBlock& superBlock = m_dataBlock->m_superBlocks[0]; // first block
|
||||
|
||||
memset((void *) &superBlock, 0, SDRDaemonUdpSize);
|
||||
|
||||
superBlock.init();
|
||||
superBlock.m_header.m_frameIndex = m_frameCount;
|
||||
superBlock.m_header.m_blockIndex = m_txBlockIndex;
|
||||
memcpy((void *) &superBlock.m_protectedBlock, (const void *) &metaData, sizeof(SDRDaemonMetaDataFEC));
|
||||
@ -136,10 +138,6 @@ void SDRDaemonChannelSink::feed(const SampleVector::const_iterator& begin, const
|
||||
m_currentMetaFEC = metaData;
|
||||
}
|
||||
|
||||
if (!m_dataBlock) {
|
||||
m_dataBlock = new SDRDaemonDataBlock();
|
||||
}
|
||||
|
||||
m_txBlockIndex = 1; // next Tx block with data
|
||||
} // block zero
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
#include "dsp/dsptypes.h"
|
||||
|
||||
#define UDPSINKFEC_UDPSIZE 512
|
||||
@ -51,8 +52,15 @@ struct SDRDaemonMetaDataFEC
|
||||
|
||||
void init()
|
||||
{
|
||||
memset((void *) this, 0, sizeof(SDRDaemonMetaDataFEC));
|
||||
m_centerFrequency = 0;
|
||||
m_sampleRate = 0;
|
||||
m_sampleBytes = 0;
|
||||
m_sampleBits = 0;
|
||||
m_nbOriginalBlocks = 0;
|
||||
m_nbFECBlocks = -1;
|
||||
m_tv_sec = 0;
|
||||
m_tv_usec = 0;
|
||||
m_crc32 = 0;
|
||||
}
|
||||
};
|
||||
|
||||
@ -61,6 +69,13 @@ struct SDRDaemonHeader
|
||||
uint16_t m_frameIndex;
|
||||
uint8_t m_blockIndex;
|
||||
uint8_t m_filler;
|
||||
|
||||
void init()
|
||||
{
|
||||
m_frameIndex = 0;
|
||||
m_blockIndex = 0;
|
||||
m_filler = 0;
|
||||
}
|
||||
};
|
||||
|
||||
static const int SDRDaemonUdpSize = UDPSINKFEC_UDPSIZE;
|
||||
@ -70,12 +85,22 @@ static const int SDRDaemonSamplesPerBlock = (UDPSINKFEC_UDPSIZE - sizeof(SDRDaem
|
||||
struct SDRDaemonProtectedBlock
|
||||
{
|
||||
Sample m_samples[SDRDaemonSamplesPerBlock];
|
||||
|
||||
void init() {
|
||||
std::fill(m_samples, m_samples+SDRDaemonSamplesPerBlock, Sample{0,0});
|
||||
}
|
||||
};
|
||||
|
||||
struct SDRDaemonSuperBlock
|
||||
{
|
||||
SDRDaemonHeader m_header;
|
||||
SDRDaemonProtectedBlock m_protectedBlock;
|
||||
|
||||
void init()
|
||||
{
|
||||
m_header.init();
|
||||
m_protectedBlock.init();
|
||||
}
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
@ -99,8 +124,14 @@ struct SDRDaemonTxControlBlock
|
||||
class SDRDaemonDataBlock
|
||||
{
|
||||
public:
|
||||
SDRDaemonDataBlock() {
|
||||
m_superBlocks = new SDRDaemonSuperBlock[256];
|
||||
}
|
||||
~SDRDaemonDataBlock() {
|
||||
delete[] m_superBlocks;
|
||||
}
|
||||
SDRDaemonTxControlBlock m_controlBlock;
|
||||
SDRDaemonSuperBlock m_superBlocks[256];
|
||||
SDRDaemonSuperBlock *m_superBlocks;
|
||||
};
|
||||
|
||||
#endif /* SDRDAEMON_CHANNEL_SDRDAEMONDATABLOCK_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user