1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-06-01 22:42:25 -04:00

SDRdaemonFEC support. auto R/W correction (1)

This commit is contained in:
f4exb 2016-07-12 08:52:38 +02:00
parent 6540979108
commit 95804345d5
3 changed files with 8 additions and 6 deletions

View File

@ -74,6 +74,9 @@ void SDRdaemonFECBuffer::initReadIndex()
void SDRdaemonFECBuffer::checkSlotData(int slotIndex) void SDRdaemonFECBuffer::checkSlotData(int slotIndex)
{ {
int pseudoWriteIndex = slotIndex * sizeof(BufferFrame);
m_wrDeltaEstimate = pseudoWriteIndex - m_readIndex;
if (!m_decoderSlots[slotIndex].m_decoded) if (!m_decoderSlots[slotIndex].m_decoded)
//if (m_decoderSlots[slotIndex].m_blockCount < m_nbOriginalBlocks) //if (m_decoderSlots[slotIndex].m_blockCount < m_nbOriginalBlocks)
{ {
@ -91,7 +94,7 @@ void SDRdaemonFECBuffer::checkSlotData(int slotIndex)
int sampleRate = metaData->m_sampleRate; int sampleRate = metaData->m_sampleRate;
if (sampleRate > 0) { if (sampleRate > 0) {
m_bufferLenSec = (float) m_framesNbBytes / (float) sampleRate; m_bufferLenSec = (float) m_framesNbBytes / (float) (sampleRate * m_iqSampleSize);
} }
printMeta("SDRdaemonFECBuffer::checkSlotData: new meta", metaData); // print for change other than timestamp printMeta("SDRdaemonFECBuffer::checkSlotData: new meta", metaData); // print for change other than timestamp
@ -103,9 +106,6 @@ void SDRdaemonFECBuffer::checkSlotData(int slotIndex)
void SDRdaemonFECBuffer::initDecodeSlot(int slotIndex) void SDRdaemonFECBuffer::initDecodeSlot(int slotIndex)
{ {
int pseudoWriteIndex = slotIndex * sizeof(BufferFrame);
m_wrDeltaEstimate = pseudoWriteIndex - m_readIndex;
// collect stats before voiding the slot // collect stats before voiding the slot
m_curNbBlocks = m_decoderSlots[slotIndex].m_blockCount; m_curNbBlocks = m_decoderSlots[slotIndex].m_blockCount;
m_curNbRecovery = m_decoderSlots[slotIndex].m_recoveryCount; m_curNbRecovery = m_decoderSlots[slotIndex].m_recoveryCount;

View File

@ -98,8 +98,8 @@ public:
float getAvgNbBlocks() const { return m_avgNbBlocks; } float getAvgNbBlocks() const { return m_avgNbBlocks; }
float getAvgNbRecovery() const { return m_avgNbRecovery; } float getAvgNbRecovery() const { return m_avgNbRecovery; }
float getBufferLengthInSecs() const { return m_bufferLenSec; } float getBufferLengthInSecs() const { return m_bufferLenSec; }
int32_t getRWBalanceCorrection(int throttlems) const { return m_balCorrection; }
/** Get buffer gauge value in % of buffer size ([-50:50]) /** Get buffer gauge value in % of buffer size ([-50:50])
* [-50:0] : write leads or read lags * [-50:0] : write leads or read lags
@ -168,11 +168,13 @@ private:
uint32_t m_throttlemsNominal; //!< Initial throttle in ms uint32_t m_throttlemsNominal; //!< Initial throttle in ms
uint8_t* m_readBuffer; //!< Read buffer to hold samples when looping back to beginning of raw buffer uint8_t* m_readBuffer; //!< Read buffer to hold samples when looping back to beginning of raw buffer
uint32_t m_readSize; //!< Read buffer size uint32_t m_readSize; //!< Read buffer size
int32_t m_balCorrection; //!< R/W balance correction in number of samples per nominal tick period
float m_bufferLenSec; float m_bufferLenSec;
void initDecodeAllSlots(); void initDecodeAllSlots();
void initReadIndex(); void initReadIndex();
void rwSkewEstimate(int slotIndex);
void checkSlotData(int slotIndex); void checkSlotData(int slotIndex);
void initDecodeSlot(int slotIndex); void initDecodeSlot(int slotIndex);

View File

@ -49,7 +49,7 @@ SDRdaemonFECUDPHandler::SDRdaemonFECUDPHandler(SampleFifo *sampleFifo, MessageQu
m_readLength(0), m_readLength(0),
m_throttleToggle(false), m_throttleToggle(false),
m_rateDivider(1000/SDRDAEMONFEC_THROTTLE_MS), m_rateDivider(1000/SDRDAEMONFEC_THROTTLE_MS),
m_autoCorrBuffer(false) m_autoCorrBuffer(true)
{ {
m_udpBuf = new char[SDRdaemonFECBuffer::m_udpPayloadSize]; m_udpBuf = new char[SDRdaemonFECBuffer::m_udpPayloadSize];
} }