mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-29 21:42:26 -04:00
SDRdaemon plugin: Ensure a minimal size of the main buffer depending on frame size so that auto follow ups work fine
This commit is contained in:
parent
0ffc02102e
commit
b7a4c468fc
@ -27,6 +27,7 @@ const int SDRdaemonBuffer::m_udpPayloadSize = 512;
|
|||||||
const int SDRdaemonBuffer::m_sampleSize = 2;
|
const int SDRdaemonBuffer::m_sampleSize = 2;
|
||||||
const int SDRdaemonBuffer::m_iqSampleSize = 2 * m_sampleSize;
|
const int SDRdaemonBuffer::m_iqSampleSize = 2 * m_sampleSize;
|
||||||
const int SDRdaemonBuffer::m_rawBufferLengthSeconds = 8; // should be even
|
const int SDRdaemonBuffer::m_rawBufferLengthSeconds = 8; // should be even
|
||||||
|
const int SDRdaemonBuffer::m_rawBufferMinNbFrames = 50;
|
||||||
|
|
||||||
SDRdaemonBuffer::SDRdaemonBuffer(uint32_t throttlems) :
|
SDRdaemonBuffer::SDRdaemonBuffer(uint32_t throttlems) :
|
||||||
m_throttlemsNominal(throttlems),
|
m_throttlemsNominal(throttlems),
|
||||||
@ -95,6 +96,11 @@ 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
|
uint32_t rawSize = sampleRate * m_iqSampleSize * m_rawBufferLengthSeconds; // store worth of this seconds of samples at this sample rate
|
||||||
|
|
||||||
|
if ((m_frameSize > 0) && (rawSize / m_frameSize < m_rawBufferMinNbFrames))
|
||||||
|
{
|
||||||
|
rawSize = m_rawBufferMinNbFrames * m_frameSize; // ensure a minimal size of this times the write block size so that auto follow ups work fine
|
||||||
|
}
|
||||||
|
|
||||||
if (rawSize != m_rawSize)
|
if (rawSize != m_rawSize)
|
||||||
{
|
{
|
||||||
m_rawSize = rawSize;
|
m_rawSize = rawSize;
|
||||||
@ -109,6 +115,7 @@ void SDRdaemonBuffer::updateBufferSize(uint32_t sampleRate)
|
|||||||
|
|
||||||
qDebug() << "SDRdaemonBuffer::updateBufferSize:"
|
qDebug() << "SDRdaemonBuffer::updateBufferSize:"
|
||||||
<< " sampleRate: " << sampleRate
|
<< " sampleRate: " << sampleRate
|
||||||
|
<< " m_frameSize: " << m_frameSize
|
||||||
<< " m_rawSize: " << m_rawSize;
|
<< " m_rawSize: " << m_rawSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -221,7 +228,11 @@ bool SDRdaemonBuffer::readMeta(char *array, uint32_t length)
|
|||||||
m_lz4 = false;
|
m_lz4 = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (frameSize != m_frameSize) {
|
||||||
m_frameSize = frameSize;
|
m_frameSize = frameSize;
|
||||||
|
updateBufferSize(m_sampleRate);
|
||||||
|
}
|
||||||
|
|
||||||
m_sync = true;
|
m_sync = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -111,6 +111,7 @@ public:
|
|||||||
static const int m_sampleSize;
|
static const int m_sampleSize;
|
||||||
static const int m_iqSampleSize;
|
static const int m_iqSampleSize;
|
||||||
static const int m_rawBufferLengthSeconds;
|
static const int m_rawBufferLengthSeconds;
|
||||||
|
static const int m_rawBufferMinNbFrames; //!< Minimum number of frames for the length of buffer
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateBufferSize(uint32_t sampleRate);
|
void updateBufferSize(uint32_t sampleRate);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user