mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-17 13:51:47 -05:00
SDRDaemonSink: ananonymize protected bloc in UDPSinkFEC also
This commit is contained in:
parent
d3455d9cdf
commit
9bf030c824
@ -620,7 +620,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>API IP address</string>
|
||||
<string>Remote API IPv4 address</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>000.000.000.000</string>
|
||||
@ -646,7 +646,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>API IP port</string>
|
||||
<string>Remote API port</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>00000</string>
|
||||
@ -711,7 +711,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remote data address</string>
|
||||
<string>Remote data connection IPv4 address</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>000.000.000.000</string>
|
||||
@ -737,7 +737,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remote data port</string>
|
||||
<string>Remote data connection port</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>00000</string>
|
||||
|
@ -92,9 +92,11 @@ bool SDRdaemonSinkOutput::start()
|
||||
m_sdrDaemonSinkThread->connectTimer(m_masterTimer);
|
||||
m_sdrDaemonSinkThread->startWork();
|
||||
|
||||
// restart auto rate correction
|
||||
m_lastRemoteTimestampRateCorrection = 0;
|
||||
m_lastTimestampRateCorrection = 0;
|
||||
m_lastQueueLength = -2; // set first value out of bounds
|
||||
m_chunkSizeCorrection = 0;
|
||||
|
||||
double delay = ((127*126*m_settings.m_txDelay) / m_settings.m_sampleRate)/(128 + m_settings.m_nbFECBlocks);
|
||||
m_sdrDaemonSinkThread->setTxDelay((int) (delay*1e6));
|
||||
|
@ -141,18 +141,34 @@ void UDPSinkFEC::write(const SampleVector::iterator& begin, uint32_t sampleChunk
|
||||
m_txBlockIndex = 1; // next Tx block with data
|
||||
}
|
||||
|
||||
int samplesPerBlock = bytesPerBlock / (m_sampleBytes*2);
|
||||
|
||||
if (m_sampleIndex + inRemainingSamples < samplesPerBlock) // there is still room in the current super block
|
||||
{
|
||||
if (SDR_RX_SAMP_SZ == SDR_TX_SAMP_SZ) // can do direct copy if sizes are equal (to 16 bits)
|
||||
if (sizeof(Sample) == m_sampleBytes*2) // can do direct copy if sample sizes are equal
|
||||
{
|
||||
memcpy((char *) &m_superBlock.protectedBlock.m_samples[m_sampleIndex],
|
||||
memcpy((char *) &m_superBlock.protectedBlock.m_buf[m_sampleIndex*m_sampleBytes*2],
|
||||
(const char *) &(*it),
|
||||
inRemainingSamples * sizeof(Sample));
|
||||
}
|
||||
else // Samples are limited to 16 bits by the modulators
|
||||
else if ((sizeof(Sample) == 8) && (m_sampleBytes == 2)) // modulators produce 16 bit samples
|
||||
{
|
||||
for (int is = 0; is < inRemainingSamples; is++) {
|
||||
m_superBlock.protectedBlock.m_samples[m_sampleIndex+is] = *(it+is);
|
||||
for (int is = 0; is < inRemainingSamples; is++)
|
||||
{
|
||||
int16_t *rp = (int16_t*) &(m_superBlock.protectedBlock.m_buf[(m_sampleIndex+is)*m_sampleBytes*2]);
|
||||
int16_t *ip = (int16_t*) &(m_superBlock.protectedBlock.m_buf[(m_sampleIndex+is)*m_sampleBytes*2+2]);
|
||||
*rp = (it+is)->m_real & 0xFFFF;
|
||||
*ip = (it+is)->m_imag & 0xFFFF;
|
||||
}
|
||||
}
|
||||
else if ((sizeof(Sample) == 4) && (m_sampleBytes == 4)) // use 16 bit samples for Tx
|
||||
{
|
||||
for (int is = 0; is < inRemainingSamples; is++)
|
||||
{
|
||||
int32_t *rp = (int32_t*) &(m_superBlock.protectedBlock.m_buf[(m_sampleIndex+is)*m_sampleBytes*2]);
|
||||
int32_t *ip = (int32_t*) &(m_superBlock.protectedBlock.m_buf[(m_sampleIndex+is)*m_sampleBytes*2+4]);
|
||||
*rp = (it+is)->m_real;
|
||||
*ip = (it+is)->m_imag;
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,16 +177,30 @@ void UDPSinkFEC::write(const SampleVector::iterator& begin, uint32_t sampleChunk
|
||||
}
|
||||
else // complete super block and initiate the next if not end of frame
|
||||
{
|
||||
if (SDR_RX_SAMP_SZ == SDR_TX_SAMP_SZ) // can do direct copy if sizes are equal (to 16 bits)
|
||||
if (sizeof(Sample) == m_sampleBytes*2) // can do direct copy if sample sizes are equal
|
||||
{
|
||||
memcpy((char *) &m_superBlock.protectedBlock.m_samples[m_sampleIndex],
|
||||
memcpy((char *) &m_superBlock.protectedBlock.m_buf[m_sampleIndex*m_sampleBytes*2],
|
||||
(const char *) &(*it),
|
||||
(samplesPerBlock - m_sampleIndex) * sizeof(Sample));
|
||||
}
|
||||
else // Samples are limited to 16 bits by the modulators
|
||||
else if ((sizeof(Sample) == 8) && (m_sampleBytes == 2)) // modulators produce 16 bit samples
|
||||
{
|
||||
for (int is = 0; is < samplesPerBlock - m_sampleIndex; is++) {
|
||||
m_superBlock.protectedBlock.m_samples[m_sampleIndex+is] = *(it+is);
|
||||
for (int is = 0; is < samplesPerBlock - m_sampleIndex; is++)
|
||||
{
|
||||
int16_t *rp = (int16_t*) &(m_superBlock.protectedBlock.m_buf[(m_sampleIndex+is)*m_sampleBytes*2]);
|
||||
int16_t *ip = (int16_t*) &(m_superBlock.protectedBlock.m_buf[(m_sampleIndex+is)*m_sampleBytes*2+2]);
|
||||
*rp = (it+is)->m_real & 0xFFFF;
|
||||
*ip = (it+is)->m_imag & 0xFFFF;
|
||||
}
|
||||
}
|
||||
else if ((sizeof(Sample) == 4) && (m_sampleBytes == 4)) // use 16 bit samples for Tx
|
||||
{
|
||||
for (int is = 0; is < samplesPerBlock - m_sampleIndex; is++)
|
||||
{
|
||||
int32_t *rp = (int32_t*) &(m_superBlock.protectedBlock.m_buf[(m_sampleIndex+is)*m_sampleBytes*2]);
|
||||
int32_t *ip = (int32_t*) &(m_superBlock.protectedBlock.m_buf[(m_sampleIndex+is)*m_sampleBytes*2+4]);
|
||||
*rp = (it+is)->m_real;
|
||||
*ip = (it+is)->m_imag;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,11 +75,11 @@ public:
|
||||
uint32_t filler2;
|
||||
};
|
||||
|
||||
static const int samplesPerBlock = (m_udpSize - sizeof(Header)) / (2 * SDR_TX_SAMP_SZ);
|
||||
static const int bytesPerBlock = m_udpSize - sizeof(Header);
|
||||
|
||||
struct ProtectedBlock
|
||||
{
|
||||
Sample m_samples[samplesPerBlock];
|
||||
uint8_t m_buf[bytesPerBlock];
|
||||
};
|
||||
|
||||
struct SuperBlock
|
||||
|
@ -584,7 +584,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Local data connection IP address</string>
|
||||
<string>Remote API IPv4 address</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>000.000.000.000</string>
|
||||
@ -619,7 +619,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remote control port</string>
|
||||
<string>Remote API port</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>00000</string>
|
||||
@ -692,6 +692,9 @@
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Local data connection IPv4 address</string>
|
||||
</property>
|
||||
<property name="inputMask">
|
||||
<string>000.000.000.000</string>
|
||||
</property>
|
||||
|
Loading…
Reference in New Issue
Block a user