SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
RemoteInputBuffer Class Reference

#include <remoteinputbuffer.h>

+ Collaboration diagram for RemoteInputBuffer:

Classes

struct  BufferFrame
 
struct  DecoderSlot
 

Public Member Functions

 RemoteInputBuffer ()
 
 ~RemoteInputBuffer ()
 
void writeData (char *array)
 Write data into buffer. More...
 
uint8_treadData (int32_t length)
 Read data from buffer. More...
 
const RemoteMetaDataFECgetCurrentMeta () const
 
uint32_t getTVOutSec () const
 
uint32_t getTVOutUsec () const
 
uint64_t getTVOutMSec () const
 
int getCurNbBlocks () const
 
int getCurOriginalBlocks () const
 
int getCurNbRecovery () const
 
float getAvgNbBlocks () const
 
float getAvgOriginalBlocks () const
 
float getAvgNbRecovery () const
 
int getMinNbBlocks ()
 
int getMinOriginalBlocks ()
 
int getMaxNbRecovery ()
 
bool allFramesDecoded ()
 
float getBufferLengthInSecs () const
 
int32_t getRWBalanceCorrection () const
 
int32_t getBufferGauge () const
 

Static Public Attributes

static const int framesSize = REMOTEINPUT_NBDECODERSLOTS * (RemoteNbOrginalBlocks - 1) * RemoteNbBytesPerBlock
 

Private Member Functions

RemoteProtectedBlockstoreOriginalBlock (int slotIndex, int blockIndex, const RemoteProtectedBlock &protectedBlock)
 
RemoteProtectedBlockgetOriginalBlock (int slotIndex, int blockIndex)
 
RemoteMetaDataFECgetMetaData (int slotIndex)
 
void resetOriginalBlocks (int slotIndex)
 
void initDecodeAllSlots ()
 
void initReadIndex ()
 
void rwCorrectionEstimate (int slotIndex)
 
void checkSlotData (int slotIndex)
 
void initDecodeSlot (int slotIndex)
 

Static Private Member Functions

static void printMeta (const QString &header, RemoteMetaDataFEC *metaData)
 

Private Attributes

RemoteMetaDataFEC m_currentMeta
 Stored current meta data. More...
 
CM256::cm256_encoder_params m_paramsCM256
 CM256 decoder parameters block. More...
 
DecoderSlot m_decoderSlots [nbDecoderSlots]
 CM256 decoding control/buffer slots. More...
 
BufferFrame m_frames [nbDecoderSlots]
 Samples buffer. More...
 
int m_framesNbBytes
 Number of bytes in samples buffer. More...
 
int m_decoderIndexHead
 index of the current head frame slot in decoding slots More...
 
int m_frameHead
 index of the current head frame sent More...
 
int m_curNbBlocks
 (stats) instantaneous number of blocks received More...
 
int m_minNbBlocks
 (stats) minimum number of blocks received since last poll More...
 
int m_curOriginalBlocks
 (stats) instantanous number of original blocks received More...
 
int m_minOriginalBlocks
 (stats) minimum number of original blocks received since last poll More...
 
int m_curNbRecovery
 (stats) instantaneous number of recovery blocks used More...
 
int m_maxNbRecovery
 (stats) maximum number of recovery blocks used since last poll More...
 
MovingAverageUtil< int, int, 10 > m_avgNbBlocks
 (stats) average number of blocks received More...
 
MovingAverageUtil< int, int, 10 > m_avgOrigBlocks
 (stats) average number of original blocks received More...
 
MovingAverageUtil< int, int, 10 > m_avgNbRecovery
 (stats) average number of recovery blocks used More...
 
bool m_framesDecoded
 [stats] true if all frames were decoded since last poll More...
 
int m_readIndex
 current byte read index in frames buffer More...
 
int m_wrDeltaEstimate
 Sampled estimate of write to read indexes difference. More...
 
uint32_t m_tvOut_sec
 Estimated returned samples timestamp (seconds) More...
 
uint32_t m_tvOut_usec
 Estimated returned samples timestamp (microseconds) More...
 
int m_readNbBytes
 Nominal number of bytes per read (50ms) More...
 
uint8_tm_readBuffer
 Read buffer to hold samples when looping back to beginning of raw buffer. More...
 
int m_readSize
 Read buffer size. More...
 
float m_bufferLenSec
 
int m_nbReads
 Number of buffer reads since start of auto R/W balance correction period. More...
 
int m_nbWrites
 Number of buffer writes since start of auto R/W balance correction period. More...
 
int m_balCorrection
 R/W balance correction in number of samples. More...
 
int m_balCorrLimit
 Correction absolute value limit in number of samples. More...
 
CM256 m_cm256
 CM256 library. More...
 
bool m_cm256_OK
 CM256 library initialized OK. More...
 

Static Private Attributes

static const int nbDecoderSlots = REMOTEINPUT_NBDECODERSLOTS
 

Detailed Description

Definition at line 33 of file remoteinputbuffer.h.

Constructor & Destructor Documentation

◆ RemoteInputBuffer()

RemoteInputBuffer::RemoteInputBuffer ( )

Definition at line 29 of file remoteinputbuffer.cpp.

References RemoteMetaDataFEC::init(), m_currentMeta, m_framesNbBytes, m_paramsCM256, m_readNbBytes, m_tvOut_sec, m_tvOut_usec, m_wrDeltaEstimate, and nbDecoderSlots.

29  :
31  m_frameHead(0),
32  m_curNbBlocks(0),
33  m_minNbBlocks(256),
36  m_curNbRecovery(0),
37  m_maxNbRecovery(0),
38  m_framesDecoded(true),
39  m_readIndex(0),
40  m_readBuffer(0),
41  m_readSize(0),
42  m_bufferLenSec(0.0f),
43  m_nbReads(0),
44  m_nbWrites(0),
45  m_balCorrection(0),
47 {
49  m_framesNbBytes = nbDecoderSlots * sizeof(BufferFrame);
51  m_tvOut_sec = 0;
52  m_tvOut_usec = 0;
53  m_readNbBytes = 1;
54  m_paramsCM256.BlockBytes = sizeof(RemoteProtectedBlock); // never changes
55  m_paramsCM256.OriginalCount = RemoteNbOrginalBlocks; // never changes
56 
57  if (!m_cm256.isInitialized()) {
58  m_cm256_OK = false;
59  qDebug() << "RemoteInputBuffer::RemoteInputBuffer: cannot initialize CM256 library";
60  } else {
61  m_cm256_OK = true;
62  }
63 
64  std::fill(m_decoderSlots, m_decoderSlots + nbDecoderSlots, DecoderSlot());
65  std::fill(m_frames, m_frames + nbDecoderSlots, BufferFrame());
66 }
int m_readNbBytes
Nominal number of bytes per read (50ms)
int m_readIndex
current byte read index in frames buffer
RemoteMetaDataFEC m_currentMeta
Stored current meta data.
int m_minOriginalBlocks
(stats) minimum number of original blocks received since last poll
int m_maxNbRecovery
(stats) maximum number of recovery blocks used since last poll
static const int nbDecoderSlots
int m_balCorrection
R/W balance correction in number of samples.
CM256 m_cm256
CM256 library.
int m_curNbRecovery
(stats) instantaneous number of recovery blocks used
int m_curNbBlocks
(stats) instantaneous number of blocks received
bool m_framesDecoded
[stats] true if all frames were decoded since last poll
uint8_t * m_readBuffer
Read buffer to hold samples when looping back to beginning of raw buffer.
int m_framesNbBytes
Number of bytes in samples buffer.
int m_readSize
Read buffer size.
int m_nbWrites
Number of buffer writes since start of auto R/W balance correction period.
int m_balCorrLimit
Correction absolute value limit in number of samples.
CM256::cm256_encoder_params m_paramsCM256
CM256 decoder parameters block.
int m_frameHead
index of the current head frame sent
BufferFrame m_frames[nbDecoderSlots]
Samples buffer.
uint32_t m_tvOut_usec
Estimated returned samples timestamp (microseconds)
uint32_t m_tvOut_sec
Estimated returned samples timestamp (seconds)
int m_nbReads
Number of buffer reads since start of auto R/W balance correction period.
int m_minNbBlocks
(stats) minimum number of blocks received since last poll
int m_decoderIndexHead
index of the current head frame slot in decoding slots
DecoderSlot m_decoderSlots[nbDecoderSlots]
CM256 decoding control/buffer slots.
bool m_cm256_OK
CM256 library initialized OK.
int m_curOriginalBlocks
(stats) instantanous number of original blocks received
int m_wrDeltaEstimate
Sampled estimate of write to read indexes difference.
+ Here is the call graph for this function:

◆ ~RemoteInputBuffer()

RemoteInputBuffer::~RemoteInputBuffer ( )

Definition at line 68 of file remoteinputbuffer.cpp.

References m_readBuffer.

69 {
70  if (m_readBuffer) {
71  delete[] m_readBuffer;
72  }
73 }
uint8_t * m_readBuffer
Read buffer to hold samples when looping back to beginning of raw buffer.

Member Function Documentation

◆ allFramesDecoded()

bool RemoteInputBuffer::allFramesDecoded ( )
inline

Definition at line 81 of file remoteinputbuffer.h.

References m_framesDecoded.

82  {
83  bool framesDecoded = m_framesDecoded;
84  m_framesDecoded = true;
85  return framesDecoded;
86  }
bool m_framesDecoded
[stats] true if all frames were decoded since last poll

◆ checkSlotData()

void RemoteInputBuffer::checkSlotData ( int  slotIndex)
private

Definition at line 170 of file remoteinputbuffer.cpp.

References RemoteInputBuffer::DecoderSlot::m_blockCount, m_currentMeta, m_decoderSlots, m_readIndex, RemoteInputBuffer::DecoderSlot::m_recoveryCount, RemoteMetaDataFEC::m_sampleBytes, RemoteMetaDataFEC::m_sampleRate, RemoteMetaDataFEC::m_tv_sec, RemoteMetaDataFEC::m_tv_usec, m_tvOut_sec, m_tvOut_usec, m_wrDeltaEstimate, and nbDecoderSlots.

Referenced by writeData().

171 {
172  int pseudoWriteIndex = slotIndex * sizeof(BufferFrame);
173  m_wrDeltaEstimate = pseudoWriteIndex - m_readIndex;
174  int rwDelayBytes = (m_wrDeltaEstimate > 0 ? m_wrDeltaEstimate : sizeof(BufferFrame) * nbDecoderSlots + m_wrDeltaEstimate);
175  int sampleRate = m_currentMeta.m_sampleRate;
176 
177  if (sampleRate > 0)
178  {
180  ts -= (rwDelayBytes * 1000000LL) / (sampleRate * 2 * m_currentMeta.m_sampleBytes);
181  m_tvOut_sec = ts / 1000000LL;
182  m_tvOut_usec = ts - (m_tvOut_sec * 1000000LL);
183  }
184 
185  if (!m_decoderSlots[slotIndex].m_decoded)
186  {
187  qDebug() << "RemoteInputBuffer::checkSlotData: incomplete frame:"
188  << " slotIndex: " << slotIndex
189  << " m_blockCount: " << m_decoderSlots[slotIndex].m_blockCount
190  << " m_recoveryCount: " << m_decoderSlots[slotIndex].m_recoveryCount;
191  }
192 }
uint32_t m_sampleRate
12 sample rate in Hz
int m_readIndex
current byte read index in frames buffer
RemoteMetaDataFEC m_currentMeta
Stored current meta data.
static const int nbDecoderSlots
int m_blockCount
number of blocks received for this frame
__int64 int64_t
Definition: rtptypes_win.h:47
int m_recoveryCount
number of recovery blocks received
uint8_t m_sampleBytes
13 4 LSB: number of bytes per sample (2 or 4)
uint32_t m_tv_usec
24 microseconds of timestamp at start time of super-frame processing
uint32_t m_tv_sec
20 seconds of timestamp at start time of super-frame processing
uint32_t m_tvOut_usec
Estimated returned samples timestamp (microseconds)
uint32_t m_tvOut_sec
Estimated returned samples timestamp (seconds)
DecoderSlot m_decoderSlots[nbDecoderSlots]
CM256 decoding control/buffer slots.
int m_wrDeltaEstimate
Sampled estimate of write to read indexes difference.
+ Here is the caller graph for this function:

◆ getAvgNbBlocks()

float RemoteInputBuffer::getAvgNbBlocks ( ) const
inline

Definition at line 56 of file remoteinputbuffer.h.

References m_avgNbBlocks.

Referenced by RemoteInputUDPHandler::tick().

56 { return m_avgNbBlocks; }
MovingAverageUtil< int, int, 10 > m_avgNbBlocks
(stats) average number of blocks received
+ Here is the caller graph for this function:

◆ getAvgNbRecovery()

float RemoteInputBuffer::getAvgNbRecovery ( ) const
inline

Definition at line 58 of file remoteinputbuffer.h.

References m_avgNbRecovery.

Referenced by RemoteInputUDPHandler::tick().

58 { return m_avgNbRecovery; }
MovingAverageUtil< int, int, 10 > m_avgNbRecovery
(stats) average number of recovery blocks used
+ Here is the caller graph for this function:

◆ getAvgOriginalBlocks()

float RemoteInputBuffer::getAvgOriginalBlocks ( ) const
inline

Definition at line 57 of file remoteinputbuffer.h.

References m_avgOrigBlocks.

Referenced by RemoteInputUDPHandler::tick().

57 { return m_avgOrigBlocks; }
MovingAverageUtil< int, int, 10 > m_avgOrigBlocks
(stats) average number of original blocks received
+ Here is the caller graph for this function:

◆ getBufferGauge()

int32_t RemoteInputBuffer::getBufferGauge ( ) const
inline

Get buffer gauge value in % of buffer size ([-50:50]) [-50:0] : write leads or read lags [0:50] : read leads or write lags

Definition at line 95 of file remoteinputbuffer.h.

References m_framesNbBytes, and m_wrDeltaEstimate.

Referenced by RemoteInputUDPHandler::getBufferGauge(), and RemoteInputUDPHandler::tick().

96  {
97  if (m_framesNbBytes)
98  {
100  int32_t ret = val < 0 ? -val - 50 : 50 -val;
101  return ret;
102  }
103  else
104  {
105  return 0; // default position
106  }
107  }
int m_framesNbBytes
Number of bytes in samples buffer.
int int32_t
Definition: rtptypes_win.h:45
int m_wrDeltaEstimate
Sampled estimate of write to read indexes difference.
+ Here is the caller graph for this function:

◆ getBufferLengthInSecs()

float RemoteInputBuffer::getBufferLengthInSecs ( ) const
inline

Definition at line 88 of file remoteinputbuffer.h.

References m_bufferLenSec.

Referenced by RemoteInputUDPHandler::tick().

88 { return m_bufferLenSec; }
+ Here is the caller graph for this function:

◆ getCurNbBlocks()

int RemoteInputBuffer::getCurNbBlocks ( ) const
inline

Definition at line 53 of file remoteinputbuffer.h.

References m_curNbBlocks.

53 { return m_curNbBlocks; }
int m_curNbBlocks
(stats) instantaneous number of blocks received

◆ getCurNbRecovery()

int RemoteInputBuffer::getCurNbRecovery ( ) const
inline

Definition at line 55 of file remoteinputbuffer.h.

References m_curNbRecovery.

55 { return m_curNbRecovery; }
int m_curNbRecovery
(stats) instantaneous number of recovery blocks used

◆ getCurOriginalBlocks()

int RemoteInputBuffer::getCurOriginalBlocks ( ) const
inline

Definition at line 54 of file remoteinputbuffer.h.

References m_curOriginalBlocks.

54 { return m_curOriginalBlocks; }
int m_curOriginalBlocks
(stats) instantanous number of original blocks received

◆ getCurrentMeta()

const RemoteMetaDataFEC& RemoteInputBuffer::getCurrentMeta ( ) const
inline

Definition at line 44 of file remoteinputbuffer.h.

References m_currentMeta.

Referenced by RemoteInputUDPHandler::processData(), and RemoteInputUDPHandler::tick().

44 { return m_currentMeta; }
RemoteMetaDataFEC m_currentMeta
Stored current meta data.
+ Here is the caller graph for this function:

◆ getMaxNbRecovery()

int RemoteInputBuffer::getMaxNbRecovery ( )
inline

Definition at line 74 of file remoteinputbuffer.h.

References m_maxNbRecovery.

Referenced by RemoteInputUDPHandler::getMaxNbRecovery(), and RemoteInputUDPHandler::tick().

75  {
76  int maxNbRecovery = m_maxNbRecovery;
77  m_maxNbRecovery = 0;
78  return maxNbRecovery;
79  }
int m_maxNbRecovery
(stats) maximum number of recovery blocks used since last poll
+ Here is the caller graph for this function:

◆ getMetaData()

RemoteMetaDataFEC* RemoteInputBuffer::getMetaData ( int  slotIndex)
inlineprivate

Definition at line 195 of file remoteinputbuffer.h.

References RemoteInputBuffer::DecoderSlot::m_blockZero.

196  {
197  // return (MetaDataFEC *) &m_decoderSlots[slotIndex].m_originalBlocks[0];
198  return (RemoteMetaDataFEC *) &m_decoderSlots[slotIndex].m_blockZero;
199  }
RemoteProtectedBlock m_blockZero
First block of a frame. Has meta data.
DecoderSlot m_decoderSlots[nbDecoderSlots]
CM256 decoding control/buffer slots.

◆ getMinNbBlocks()

int RemoteInputBuffer::getMinNbBlocks ( )
inline

Definition at line 60 of file remoteinputbuffer.h.

References m_minNbBlocks.

Referenced by RemoteInputUDPHandler::getMinNbBlocks(), and RemoteInputUDPHandler::tick().

61  {
62  int minNbBlocks = m_minNbBlocks;
63  m_minNbBlocks = 256;
64  return minNbBlocks;
65  }
int m_minNbBlocks
(stats) minimum number of blocks received since last poll
+ Here is the caller graph for this function:

◆ getMinOriginalBlocks()

int RemoteInputBuffer::getMinOriginalBlocks ( )
inline

Definition at line 67 of file remoteinputbuffer.h.

References m_minOriginalBlocks.

Referenced by RemoteInputUDPHandler::tick().

68  {
69  int minOriginalBlocks = m_minOriginalBlocks;
70  m_minOriginalBlocks = 128;
71  return minOriginalBlocks;
72  }
int m_minOriginalBlocks
(stats) minimum number of original blocks received since last poll
+ Here is the caller graph for this function:

◆ getOriginalBlock()

RemoteProtectedBlock& RemoteInputBuffer::getOriginalBlock ( int  slotIndex,
int  blockIndex 
)
inlineprivate

Definition at line 184 of file remoteinputbuffer.h.

References RemoteInputBuffer::BufferFrame::m_blocks, and RemoteInputBuffer::DecoderSlot::m_blockZero.

185  {
186  if (blockIndex == 0) {
187  // return m_decoderSlots[slotIndex].m_originalBlocks[0];
188  return m_decoderSlots[slotIndex].m_blockZero;
189  } else {
190  // return m_decoderSlots[slotIndex].m_originalBlocks[blockIndex];
191  return m_frames[slotIndex].m_blocks[blockIndex - 1];
192  }
193  }
RemoteProtectedBlock m_blockZero
First block of a frame. Has meta data.
BufferFrame m_frames[nbDecoderSlots]
Samples buffer.
RemoteProtectedBlock m_blocks[RemoteNbOrginalBlocks - 1]
DecoderSlot m_decoderSlots[nbDecoderSlots]
CM256 decoding control/buffer slots.

◆ getRWBalanceCorrection()

int32_t RemoteInputBuffer::getRWBalanceCorrection ( ) const
inline

Definition at line 89 of file remoteinputbuffer.h.

References m_balCorrection.

Referenced by RemoteInputUDPHandler::tick().

89 { return m_balCorrection; }
int m_balCorrection
R/W balance correction in number of samples.
+ Here is the caller graph for this function:

◆ getTVOutMSec()

uint64_t RemoteInputBuffer::getTVOutMSec ( ) const
inline

Definition at line 49 of file remoteinputbuffer.h.

References m_tvOut_sec, and m_tvOut_usec.

Referenced by RemoteInputUDPHandler::processData().

49 { return (m_tvOut_sec * 1000LL) + (m_tvOut_usec/ 1000LL); }
uint32_t m_tvOut_usec
Estimated returned samples timestamp (microseconds)
uint32_t m_tvOut_sec
Estimated returned samples timestamp (seconds)
+ Here is the caller graph for this function:

◆ getTVOutSec()

uint32_t RemoteInputBuffer::getTVOutSec ( ) const
inline

Definition at line 47 of file remoteinputbuffer.h.

References m_tvOut_sec.

47 { return m_tvOut_sec; }
uint32_t m_tvOut_sec
Estimated returned samples timestamp (seconds)

◆ getTVOutUsec()

uint32_t RemoteInputBuffer::getTVOutUsec ( ) const
inline

Definition at line 48 of file remoteinputbuffer.h.

References m_tvOut_usec.

48 { return m_tvOut_usec; }
uint32_t m_tvOut_usec
Estimated returned samples timestamp (microseconds)

◆ initDecodeAllSlots()

void RemoteInputBuffer::initDecodeAllSlots ( )
private

Definition at line 75 of file remoteinputbuffer.cpp.

References i, RemoteInputBuffer::DecoderSlot::m_blockCount, RemoteInputBuffer::DecoderSlot::m_decoded, m_decoderSlots, RemoteInputBuffer::DecoderSlot::m_metaRetrieved, RemoteInputBuffer::DecoderSlot::m_originalCount, RemoteInputBuffer::DecoderSlot::m_recoveryCount, nbDecoderSlots, and resetOriginalBlocks().

Referenced by writeData().

76 {
77  for (int i = 0; i < nbDecoderSlots; i++)
78  {
82  m_decoderSlots[i].m_decoded = false;
85  memset((void *) m_decoderSlots[i].m_recoveryBlocks, 0, RemoteNbOrginalBlocks * sizeof(RemoteProtectedBlock));
86  }
87 }
void resetOriginalBlocks(int slotIndex)
static const int nbDecoderSlots
int m_blockCount
number of blocks received for this frame
int m_recoveryCount
number of recovery blocks received
int m_originalCount
number of original blocks received
int32_t i
Definition: decimators.h:244
bool m_metaRetrieved
true if meta data (block zero) was retrieved
DecoderSlot m_decoderSlots[nbDecoderSlots]
CM256 decoding control/buffer slots.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initDecodeSlot()

void RemoteInputBuffer::initDecodeSlot ( int  slotIndex)
private

Definition at line 89 of file remoteinputbuffer.cpp.

References m_avgNbBlocks, m_avgNbRecovery, m_avgOrigBlocks, RemoteInputBuffer::DecoderSlot::m_blockCount, m_curNbBlocks, m_curNbRecovery, m_curOriginalBlocks, RemoteInputBuffer::DecoderSlot::m_decoded, m_decoderSlots, m_framesDecoded, m_maxNbRecovery, RemoteInputBuffer::DecoderSlot::m_metaRetrieved, m_minNbBlocks, m_minOriginalBlocks, RemoteInputBuffer::DecoderSlot::m_originalCount, RemoteInputBuffer::DecoderSlot::m_recoveryCount, and resetOriginalBlocks().

Referenced by writeData().

90 {
91  // collect stats before voiding the slot
92 
100 
103  }
104 
107  }
108 
111  }
112 
113  // void the slot
114 
115  m_decoderSlots[slotIndex].m_blockCount = 0;
116  m_decoderSlots[slotIndex].m_originalCount = 0;
117  m_decoderSlots[slotIndex].m_recoveryCount = 0;
118  m_decoderSlots[slotIndex].m_decoded = false;
119  m_decoderSlots[slotIndex].m_metaRetrieved = false;
120 
121  resetOriginalBlocks(slotIndex);
122  memset((void *) m_decoderSlots[slotIndex].m_recoveryBlocks, 0, RemoteNbOrginalBlocks * sizeof(RemoteProtectedBlock));
123 }
int m_minOriginalBlocks
(stats) minimum number of original blocks received since last poll
void resetOriginalBlocks(int slotIndex)
int m_maxNbRecovery
(stats) maximum number of recovery blocks used since last poll
int m_blockCount
number of blocks received for this frame
MovingAverageUtil< int, int, 10 > m_avgNbBlocks
(stats) average number of blocks received
int m_curNbRecovery
(stats) instantaneous number of recovery blocks used
int m_curNbBlocks
(stats) instantaneous number of blocks received
bool m_framesDecoded
[stats] true if all frames were decoded since last poll
int m_recoveryCount
number of recovery blocks received
int m_originalCount
number of original blocks received
MovingAverageUtil< int, int, 10 > m_avgOrigBlocks
(stats) average number of original blocks received
int m_minNbBlocks
(stats) minimum number of blocks received since last poll
bool m_metaRetrieved
true if meta data (block zero) was retrieved
DecoderSlot m_decoderSlots[nbDecoderSlots]
CM256 decoding control/buffer slots.
int m_curOriginalBlocks
(stats) instantanous number of original blocks received
MovingAverageUtil< int, int, 10 > m_avgNbRecovery
(stats) average number of recovery blocks used
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initReadIndex()

void RemoteInputBuffer::initReadIndex ( )
private

Definition at line 125 of file remoteinputbuffer.cpp.

References m_decoderIndexHead, m_framesNbBytes, m_nbReads, m_nbWrites, m_readIndex, m_wrDeltaEstimate, and nbDecoderSlots.

Referenced by writeData().

126 {
127  m_readIndex = ((m_decoderIndexHead + (nbDecoderSlots/2)) % nbDecoderSlots) * sizeof(BufferFrame);
129  m_nbReads = 0;
130  m_nbWrites = 0;
131 }
int m_readIndex
current byte read index in frames buffer
static const int nbDecoderSlots
int m_framesNbBytes
Number of bytes in samples buffer.
int m_nbWrites
Number of buffer writes since start of auto R/W balance correction period.
int m_nbReads
Number of buffer reads since start of auto R/W balance correction period.
int m_decoderIndexHead
index of the current head frame slot in decoding slots
int m_wrDeltaEstimate
Sampled estimate of write to read indexes difference.
+ Here is the caller graph for this function:

◆ printMeta()

void RemoteInputBuffer::printMeta ( const QString &  header,
RemoteMetaDataFEC metaData 
)
staticprivate

Definition at line 375 of file remoteinputbuffer.cpp.

References RemoteMetaDataFEC::m_centerFrequency, RemoteMetaDataFEC::m_nbFECBlocks, RemoteMetaDataFEC::m_nbOriginalBlocks, RemoteMetaDataFEC::m_sampleBits, RemoteMetaDataFEC::m_sampleBytes, RemoteMetaDataFEC::m_sampleRate, RemoteMetaDataFEC::m_tv_sec, and RemoteMetaDataFEC::m_tv_usec.

376 {
377  qDebug() << header << ": "
378  << "|" << metaData->m_centerFrequency
379  << ":" << metaData->m_sampleRate
380  << ":" << (int) (metaData->m_sampleBytes & 0xF)
381  << ":" << (int) metaData->m_sampleBits
382  << ":" << (int) metaData->m_nbOriginalBlocks
383  << ":" << (int) metaData->m_nbFECBlocks
384  << "|" << metaData->m_tv_sec
385  << ":" << metaData->m_tv_usec
386  << "|";
387 }
uint32_t m_sampleRate
12 sample rate in Hz
uint8_t m_sampleBytes
13 4 LSB: number of bytes per sample (2 or 4)
uint8_t m_nbFECBlocks
16 number of blocks carrying FEC
uint32_t m_tv_usec
24 microseconds of timestamp at start time of super-frame processing
uint8_t m_sampleBits
14 number of effective bits per sample (deprecated)
uint32_t m_tv_sec
20 seconds of timestamp at start time of super-frame processing
uint8_t m_nbOriginalBlocks
15 number of blocks with original (protected) data
uint64_t m_centerFrequency
8 center frequency in kHz

◆ readData()

uint8_t * RemoteInputBuffer::readData ( int32_t  length)

Read data from buffer.

Definition at line 333 of file remoteinputbuffer.cpp.

References framesSize, m_frames, m_framesNbBytes, m_nbReads, m_readBuffer, m_readIndex, and m_readSize.

Referenced by RemoteInputUDPHandler::tick().

334 {
335  uint8_t *buffer = (uint8_t *) m_frames;
336  uint32_t readIndex = m_readIndex;
337 
338  m_nbReads++;
339 
340  // SEGFAULT FIX: arbitratily truncate so that it does not exceed buffer length
341  if (length > framesSize) {
342  length = framesSize;
343  }
344 
345  if (m_readIndex + length < m_framesNbBytes) // ends before buffer bound
346  {
347  m_readIndex += length;
348  return &buffer[readIndex];
349  }
350  else if (m_readIndex + length == m_framesNbBytes) // ends at buffer bound
351  {
352  m_readIndex = 0;
353  return &buffer[readIndex];
354  }
355  else // ends after buffer bound
356  {
357  if (length > m_readSize) // reallocate composition buffer if necessary
358  {
359  if (m_readBuffer) {
360  delete[] m_readBuffer;
361  }
362 
363  m_readBuffer = new uint8_t[length];
364  m_readSize = length;
365  }
366 
367  std::memcpy((void *) m_readBuffer, (const void *) &buffer[m_readIndex], m_framesNbBytes - m_readIndex); // copy end of buffer
368  length -= m_framesNbBytes - m_readIndex;
369  std::memcpy((void *) &m_readBuffer[m_framesNbBytes - m_readIndex], (const void *) buffer, length); // copy start of buffer
370  m_readIndex = length;
371  return m_readBuffer;
372  }
373 }
int m_readIndex
current byte read index in frames buffer
unsigned int uint32_t
Definition: rtptypes_win.h:46
uint8_t * m_readBuffer
Read buffer to hold samples when looping back to beginning of raw buffer.
int m_framesNbBytes
Number of bytes in samples buffer.
unsigned char uint8_t
Definition: rtptypes_win.h:42
static const int framesSize
int m_readSize
Read buffer size.
BufferFrame m_frames[nbDecoderSlots]
Samples buffer.
int m_nbReads
Number of buffer reads since start of auto R/W balance correction period.
+ Here is the caller graph for this function:

◆ resetOriginalBlocks()

void RemoteInputBuffer::resetOriginalBlocks ( int  slotIndex)
inlineprivate

Definition at line 201 of file remoteinputbuffer.h.

References RemoteInputBuffer::BufferFrame::m_blocks.

Referenced by initDecodeAllSlots(), and initDecodeSlot().

202  {
203  // memset((void *) m_decoderSlots[slotIndex].m_originalBlocks, 0, m_nbOriginalBlocks * sizeof(ProtectedBlock));
204  memset((void *) &m_decoderSlots[slotIndex].m_blockZero, 0, sizeof(RemoteProtectedBlock));
205  memset((void *) m_frames[slotIndex].m_blocks, 0, (RemoteNbOrginalBlocks - 1) * sizeof(RemoteProtectedBlock));
206  }
BufferFrame m_frames[nbDecoderSlots]
Samples buffer.
DecoderSlot m_decoderSlots[nbDecoderSlots]
CM256 decoding control/buffer slots.
+ Here is the caller graph for this function:

◆ rwCorrectionEstimate()

void RemoteInputBuffer::rwCorrectionEstimate ( int  slotIndex)
private

Definition at line 133 of file remoteinputbuffer.cpp.

References m_balCorrection, m_balCorrLimit, m_currentMeta, m_nbReads, m_nbWrites, m_readIndex, m_readNbBytes, RemoteMetaDataFEC::m_sampleBytes, and nbDecoderSlots.

Referenced by writeData().

134 {
135  if (m_nbReads >= 40) // check every ~1s as tick is ~50ms
136  {
137  int targetPivotSlot = (slotIndex + (nbDecoderSlots/2)) % nbDecoderSlots; // slot at half buffer opposite of current write slot
138  int targetPivotIndex = targetPivotSlot * sizeof(BufferFrame); // buffer index corresponding to start of above slot
139  int normalizedReadIndex = (m_readIndex < targetPivotIndex ? m_readIndex + nbDecoderSlots * sizeof(BufferFrame) : m_readIndex)
140  - (targetPivotSlot * sizeof(BufferFrame)); // normalize read index so it is positive and zero at start of pivot slot
141  int dBytes;
142  int rwDelta = (m_nbReads * m_readNbBytes) - (m_nbWrites * sizeof(BufferFrame));
143 
144  if (normalizedReadIndex < (nbDecoderSlots/ 2) * (int) sizeof(BufferFrame)) // read leads
145  {
146  dBytes = - normalizedReadIndex - rwDelta;
147  }
148  else // read lags
149  {
150  int bufSize = (nbDecoderSlots * sizeof(BufferFrame));
151  dBytes = bufSize - normalizedReadIndex - rwDelta;
152  }
153 
154  // calculate exponential moving average on floating point for better accuracy (was int)
155  double newCorrection = ((double) dBytes) / (((int) m_currentMeta.m_sampleBytes) * 2 * m_nbReads);
156  m_balCorrection = 0.25*m_balCorrection + 0.75*newCorrection; // exponential average with alpha = 0.75 (original is wrong)
157  //m_balCorrection = (m_balCorrection / 4) + (dBytes / (int) (m_currentMeta.m_sampleBytes * 2 * m_nbReads)); // correction is in number of samples. Alpha = 0.25
158 
161  } else if (m_balCorrection > m_balCorrLimit) {
163  }
164 
165  m_nbReads = 0;
166  m_nbWrites = 0;
167  }
168 }
int m_readNbBytes
Nominal number of bytes per read (50ms)
int m_readIndex
current byte read index in frames buffer
RemoteMetaDataFEC m_currentMeta
Stored current meta data.
static const int nbDecoderSlots
int m_balCorrection
R/W balance correction in number of samples.
uint8_t m_sampleBytes
13 4 LSB: number of bytes per sample (2 or 4)
int m_nbWrites
Number of buffer writes since start of auto R/W balance correction period.
int m_balCorrLimit
Correction absolute value limit in number of samples.
int m_nbReads
Number of buffer reads since start of auto R/W balance correction period.
+ Here is the caller graph for this function:

◆ storeOriginalBlock()

RemoteProtectedBlock* RemoteInputBuffer::storeOriginalBlock ( int  slotIndex,
int  blockIndex,
const RemoteProtectedBlock protectedBlock 
)
inlineprivate

Definition at line 169 of file remoteinputbuffer.h.

References RemoteInputBuffer::BufferFrame::m_blocks, and RemoteInputBuffer::DecoderSlot::m_blockZero.

170  {
171  if (blockIndex == 0) {
172  // m_decoderSlots[slotIndex].m_originalBlocks[0] = protectedBlock;
173  // return &m_decoderSlots[slotIndex].m_originalBlocks[0];
174  m_decoderSlots[slotIndex].m_blockZero = protectedBlock;
175  return &m_decoderSlots[slotIndex].m_blockZero;
176  } else {
177  // m_decoderSlots[slotIndex].m_originalBlocks[blockIndex] = protectedBlock;
178  // return &m_decoderSlots[slotIndex].m_originalBlocks[blockIndex];
179  m_frames[slotIndex].m_blocks[blockIndex - 1] = protectedBlock;
180  return &m_frames[slotIndex].m_blocks[blockIndex - 1];
181  }
182  }
RemoteProtectedBlock m_blockZero
First block of a frame. Has meta data.
BufferFrame m_frames[nbDecoderSlots]
Samples buffer.
RemoteProtectedBlock m_blocks[RemoteNbOrginalBlocks - 1]
DecoderSlot m_decoderSlots[nbDecoderSlots]
CM256 decoding control/buffer slots.

◆ writeData()

void RemoteInputBuffer::writeData ( char *  array)

Write data into buffer.

Definition at line 194 of file remoteinputbuffer.cpp.

References checkSlotData(), initDecodeAllSlots(), initDecodeSlot(), initReadIndex(), m_decoderIndexHead, m_decoderSlots, m_frameHead, RemoteHeader::m_frameIndex, RemoteSuperBlock::m_header, m_nbWrites, nbDecoderSlots, and rwCorrectionEstimate().

Referenced by RemoteInputUDPHandler::processData().

195 {
196  RemoteSuperBlock *superBlock = (RemoteSuperBlock *) array;
197  int frameIndex = superBlock->m_header.m_frameIndex;
198  int decoderIndex = frameIndex % nbDecoderSlots;
199 
200  // frame break
201 
202  if (m_frameHead == -1) // initial state
203  {
204  m_decoderIndexHead = decoderIndex; // new decoder slot head
205  m_frameHead = frameIndex;
206  initReadIndex(); // reset read index
207  initDecodeAllSlots(); // initialize all slots
208  }
209  else if (m_frameHead != frameIndex) // frame break => new frame starts
210  {
211  m_decoderIndexHead = decoderIndex; // new decoder slot head
212  m_frameHead = frameIndex; // new frame head
213  checkSlotData(decoderIndex); // check slot before re-init
214  rwCorrectionEstimate(decoderIndex);
215  m_nbWrites++;
216  initDecodeSlot(decoderIndex); // collect stats and re-initialize current slot
217  }
218 
219  // Block processing
220 
221  if (m_decoderSlots[decoderIndex].m_blockCount < RemoteNbOrginalBlocks) // not enough blocks to decode -> store data
222  {
223  int blockIndex = superBlock->m_header.m_blockIndex;
224  int blockCount = m_decoderSlots[decoderIndex].m_blockCount;
225  int recoveryCount = m_decoderSlots[decoderIndex].m_recoveryCount;
226  m_decoderSlots[decoderIndex].m_cm256DescriptorBlocks[blockCount].Index = blockIndex;
227 
228  if (blockIndex == 0) // first block with meta
229  {
230  m_decoderSlots[decoderIndex].m_metaRetrieved = true;
231  }
232 
233  if (blockIndex < RemoteNbOrginalBlocks) // original data
234  {
235  m_decoderSlots[decoderIndex].m_cm256DescriptorBlocks[blockCount].Block = (void *) storeOriginalBlock(decoderIndex, blockIndex, superBlock->m_protectedBlock);
236  m_decoderSlots[decoderIndex].m_originalCount++;
237  }
238  else // recovery data
239  {
240  m_decoderSlots[decoderIndex].m_recoveryBlocks[recoveryCount] = superBlock->m_protectedBlock;
241  m_decoderSlots[decoderIndex].m_cm256DescriptorBlocks[blockCount].Block = (void *) &m_decoderSlots[decoderIndex].m_recoveryBlocks[recoveryCount];
242  m_decoderSlots[decoderIndex].m_recoveryCount++;
243  }
244  }
245 
246  m_decoderSlots[decoderIndex].m_blockCount++;
247 
248  if (m_decoderSlots[decoderIndex].m_blockCount == RemoteNbOrginalBlocks) // ready to decode
249  {
250  m_decoderSlots[decoderIndex].m_decoded = true;
251 
252  if (m_cm256_OK && (m_decoderSlots[decoderIndex].m_recoveryCount > 0)) // recovery data used => need to decode FEC
253  {
254  m_paramsCM256.BlockBytes = sizeof(RemoteProtectedBlock); // never changes
255  m_paramsCM256.OriginalCount = RemoteNbOrginalBlocks; // never changes
256 
257  if (m_decoderSlots[decoderIndex].m_metaRetrieved) {
258  m_paramsCM256.RecoveryCount = m_currentMeta.m_nbFECBlocks;
259  } else {
260  m_paramsCM256.RecoveryCount = m_decoderSlots[decoderIndex].m_recoveryCount;
261  }
262 
263  if (m_cm256.cm256_decode(m_paramsCM256, m_decoderSlots[decoderIndex].m_cm256DescriptorBlocks)) // CM256 decode
264  {
265  qDebug() << "RemoteInputBuffer::writeData: decode CM256 error:"
266  << " decoderIndex: " << decoderIndex
267  << " m_blockCount: " << m_decoderSlots[decoderIndex].m_blockCount
268  << " m_originalCount: " << m_decoderSlots[decoderIndex].m_originalCount
269  << " m_recoveryCount: " << m_decoderSlots[decoderIndex].m_recoveryCount;
270  }
271  else
272  {
273  qDebug() << "RemoteInputBuffer::writeData: decode CM256 success:"
274  << " decoderIndex: " << decoderIndex
275  << " m_blockCount: " << m_decoderSlots[decoderIndex].m_blockCount
276  << " m_originalCount: " << m_decoderSlots[decoderIndex].m_originalCount
277  << " m_recoveryCount: " << m_decoderSlots[decoderIndex].m_recoveryCount;
278 
279  for (int ir = 0; ir < m_decoderSlots[decoderIndex].m_recoveryCount; ir++) // restore missing blocks
280  {
281  int recoveryIndex = RemoteNbOrginalBlocks - m_decoderSlots[decoderIndex].m_recoveryCount + ir;
282  int blockIndex = m_decoderSlots[decoderIndex].m_cm256DescriptorBlocks[recoveryIndex].Index;
283  RemoteProtectedBlock *recoveredBlock = (RemoteProtectedBlock *) m_decoderSlots[decoderIndex].m_cm256DescriptorBlocks[recoveryIndex].Block;
284 
285  if (blockIndex == 0) // first block with meta
286  {
287  RemoteMetaDataFEC *metaData = (RemoteMetaDataFEC *) recoveredBlock;
288 
289  boost::crc_32_type crc32;
290  crc32.process_bytes(metaData, sizeof(RemoteMetaDataFEC)-4);
291 
292  if (crc32.checksum() == metaData->m_crc32)
293  {
294  m_decoderSlots[decoderIndex].m_metaRetrieved = true;
295  printMeta("RemoteInputBuffer::writeData: recovered meta", metaData);
296  }
297  else
298  {
299  qDebug() << "RemoteInputBuffer::writeData: recovered meta: invalid CRC32";
300  }
301  }
302 
303  storeOriginalBlock(decoderIndex, blockIndex, *recoveredBlock);
304 
305  qDebug() << "RemoteInputBuffer::writeData: recovered block #" << blockIndex;
306  } // restore missing blocks
307  } // CM256 decode
308  } // recovery
309 
310  if (m_decoderSlots[decoderIndex].m_metaRetrieved) // block zero with its meta data has been received
311  {
312  RemoteMetaDataFEC *metaData = getMetaData(decoderIndex);
313 
314  if (!(*metaData == m_currentMeta))
315  {
316  uint32_t sampleRate = metaData->m_sampleRate;
317 
318  if (sampleRate != 0)
319  {
320  m_bufferLenSec = (float) m_framesNbBytes / (float) (sampleRate * metaData->m_sampleBytes * 2);
321  m_balCorrLimit = sampleRate / 400; // +/- 5% correction max per read
322  m_readNbBytes = (sampleRate * metaData->m_sampleBytes * 2) / 20;
323  }
324 
325  printMeta("RemoteInputBuffer::writeData: new meta", metaData); // print for change other than timestamp
326  }
327 
328  m_currentMeta = *metaData; // renew current meta
329  } // check block 0
330  } // decode
331 }
uint32_t m_sampleRate
12 sample rate in Hz
int m_readNbBytes
Nominal number of bytes per read (50ms)
RemoteMetaDataFEC m_currentMeta
Stored current meta data.
static void printMeta(const QString &header, RemoteMetaDataFEC *metaData)
CM256::cm256_block m_cm256DescriptorBlocks[RemoteNbOrginalBlocks]
CM256 decoder descriptors (block addresses and block indexes)
RemoteProtectedBlock m_protectedBlock
static const int nbDecoderSlots
int m_blockCount
number of blocks received for this frame
RemoteProtectedBlock * storeOriginalBlock(int slotIndex, int blockIndex, const RemoteProtectedBlock &protectedBlock)
CM256 m_cm256
CM256 library.
unsigned int uint32_t
Definition: rtptypes_win.h:46
int m_framesNbBytes
Number of bytes in samples buffer.
int m_recoveryCount
number of recovery blocks received
uint8_t m_sampleBytes
13 4 LSB: number of bytes per sample (2 or 4)
int m_originalCount
number of original blocks received
void initDecodeSlot(int slotIndex)
uint32_t m_crc32
28 CRC32 of the above
int m_nbWrites
Number of buffer writes since start of auto R/W balance correction period.
int m_balCorrLimit
Correction absolute value limit in number of samples.
RemoteProtectedBlock m_recoveryBlocks[RemoteNbOrginalBlocks]
Recovery blocks (FEC blocks) with max size.
uint8_t m_nbFECBlocks
16 number of blocks carrying FEC
uint8_t m_blockIndex
CM256::cm256_encoder_params m_paramsCM256
CM256 decoder parameters block.
int m_frameHead
index of the current head frame sent
RemoteMetaDataFEC * getMetaData(int slotIndex)
RemoteHeader m_header
void rwCorrectionEstimate(int slotIndex)
uint16_t m_frameIndex
void checkSlotData(int slotIndex)
int m_decoderIndexHead
index of the current head frame slot in decoding slots
bool m_metaRetrieved
true if meta data (block zero) was retrieved
DecoderSlot m_decoderSlots[nbDecoderSlots]
CM256 decoding control/buffer slots.
uint32_t crc32(const uint8_t *buf, int len)
Definition: crc.h:58
bool m_cm256_OK
CM256 library initialized OK.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ framesSize

const int RemoteInputBuffer::framesSize = REMOTEINPUT_NBDECODERSLOTS * (RemoteNbOrginalBlocks - 1) * RemoteNbBytesPerBlock
static

Definition at line 109 of file remoteinputbuffer.h.

Referenced by readData().

◆ m_avgNbBlocks

MovingAverageUtil<int, int, 10> RemoteInputBuffer::m_avgNbBlocks
private

(stats) average number of blocks received

Definition at line 147 of file remoteinputbuffer.h.

Referenced by getAvgNbBlocks(), and initDecodeSlot().

◆ m_avgNbRecovery

MovingAverageUtil<int, int, 10> RemoteInputBuffer::m_avgNbRecovery
private

(stats) average number of recovery blocks used

Definition at line 149 of file remoteinputbuffer.h.

Referenced by getAvgNbRecovery(), and initDecodeSlot().

◆ m_avgOrigBlocks

MovingAverageUtil<int, int, 10> RemoteInputBuffer::m_avgOrigBlocks
private

(stats) average number of original blocks received

Definition at line 148 of file remoteinputbuffer.h.

Referenced by getAvgOriginalBlocks(), and initDecodeSlot().

◆ m_balCorrection

int RemoteInputBuffer::m_balCorrection
private

R/W balance correction in number of samples.

Definition at line 164 of file remoteinputbuffer.h.

Referenced by getRWBalanceCorrection(), and rwCorrectionEstimate().

◆ m_balCorrLimit

int RemoteInputBuffer::m_balCorrLimit
private

Correction absolute value limit in number of samples.

Definition at line 165 of file remoteinputbuffer.h.

Referenced by rwCorrectionEstimate().

◆ m_bufferLenSec

float RemoteInputBuffer::m_bufferLenSec
private

Definition at line 160 of file remoteinputbuffer.h.

Referenced by getBufferLengthInSecs().

◆ m_cm256

CM256 RemoteInputBuffer::m_cm256
private

CM256 library.

Definition at line 166 of file remoteinputbuffer.h.

◆ m_cm256_OK

bool RemoteInputBuffer::m_cm256_OK
private

CM256 library initialized OK.

Definition at line 167 of file remoteinputbuffer.h.

◆ m_curNbBlocks

int RemoteInputBuffer::m_curNbBlocks
private

(stats) instantaneous number of blocks received

Definition at line 141 of file remoteinputbuffer.h.

Referenced by getCurNbBlocks(), and initDecodeSlot().

◆ m_curNbRecovery

int RemoteInputBuffer::m_curNbRecovery
private

(stats) instantaneous number of recovery blocks used

Definition at line 145 of file remoteinputbuffer.h.

Referenced by getCurNbRecovery(), and initDecodeSlot().

◆ m_curOriginalBlocks

int RemoteInputBuffer::m_curOriginalBlocks
private

(stats) instantanous number of original blocks received

Definition at line 143 of file remoteinputbuffer.h.

Referenced by getCurOriginalBlocks(), and initDecodeSlot().

◆ m_currentMeta

RemoteMetaDataFEC RemoteInputBuffer::m_currentMeta
private

Stored current meta data.

Definition at line 134 of file remoteinputbuffer.h.

Referenced by checkSlotData(), getCurrentMeta(), RemoteInputBuffer(), and rwCorrectionEstimate().

◆ m_decoderIndexHead

int RemoteInputBuffer::m_decoderIndexHead
private

index of the current head frame slot in decoding slots

Definition at line 139 of file remoteinputbuffer.h.

Referenced by initReadIndex(), and writeData().

◆ m_decoderSlots

DecoderSlot RemoteInputBuffer::m_decoderSlots[nbDecoderSlots]
private

CM256 decoding control/buffer slots.

Definition at line 136 of file remoteinputbuffer.h.

Referenced by checkSlotData(), initDecodeAllSlots(), initDecodeSlot(), and writeData().

◆ m_frameHead

int RemoteInputBuffer::m_frameHead
private

index of the current head frame sent

Definition at line 140 of file remoteinputbuffer.h.

Referenced by writeData().

◆ m_frames

BufferFrame RemoteInputBuffer::m_frames[nbDecoderSlots]
private

Samples buffer.

Definition at line 137 of file remoteinputbuffer.h.

Referenced by readData().

◆ m_framesDecoded

bool RemoteInputBuffer::m_framesDecoded
private

[stats] true if all frames were decoded since last poll

Definition at line 150 of file remoteinputbuffer.h.

Referenced by allFramesDecoded(), and initDecodeSlot().

◆ m_framesNbBytes

int RemoteInputBuffer::m_framesNbBytes
private

Number of bytes in samples buffer.

Definition at line 138 of file remoteinputbuffer.h.

Referenced by getBufferGauge(), initReadIndex(), readData(), and RemoteInputBuffer().

◆ m_maxNbRecovery

int RemoteInputBuffer::m_maxNbRecovery
private

(stats) maximum number of recovery blocks used since last poll

Definition at line 146 of file remoteinputbuffer.h.

Referenced by getMaxNbRecovery(), and initDecodeSlot().

◆ m_minNbBlocks

int RemoteInputBuffer::m_minNbBlocks
private

(stats) minimum number of blocks received since last poll

Definition at line 142 of file remoteinputbuffer.h.

Referenced by getMinNbBlocks(), and initDecodeSlot().

◆ m_minOriginalBlocks

int RemoteInputBuffer::m_minOriginalBlocks
private

(stats) minimum number of original blocks received since last poll

Definition at line 144 of file remoteinputbuffer.h.

Referenced by getMinOriginalBlocks(), and initDecodeSlot().

◆ m_nbReads

int RemoteInputBuffer::m_nbReads
private

Number of buffer reads since start of auto R/W balance correction period.

Definition at line 162 of file remoteinputbuffer.h.

Referenced by initReadIndex(), readData(), and rwCorrectionEstimate().

◆ m_nbWrites

int RemoteInputBuffer::m_nbWrites
private

Number of buffer writes since start of auto R/W balance correction period.

Definition at line 163 of file remoteinputbuffer.h.

Referenced by initReadIndex(), rwCorrectionEstimate(), and writeData().

◆ m_paramsCM256

CM256::cm256_encoder_params RemoteInputBuffer::m_paramsCM256
private

CM256 decoder parameters block.

Definition at line 135 of file remoteinputbuffer.h.

Referenced by RemoteInputBuffer().

◆ m_readBuffer

uint8_t* RemoteInputBuffer::m_readBuffer
private

Read buffer to hold samples when looping back to beginning of raw buffer.

Definition at line 157 of file remoteinputbuffer.h.

Referenced by readData(), and ~RemoteInputBuffer().

◆ m_readIndex

int RemoteInputBuffer::m_readIndex
private

current byte read index in frames buffer

Definition at line 151 of file remoteinputbuffer.h.

Referenced by checkSlotData(), initReadIndex(), readData(), and rwCorrectionEstimate().

◆ m_readNbBytes

int RemoteInputBuffer::m_readNbBytes
private

Nominal number of bytes per read (50ms)

Definition at line 155 of file remoteinputbuffer.h.

Referenced by RemoteInputBuffer(), and rwCorrectionEstimate().

◆ m_readSize

int RemoteInputBuffer::m_readSize
private

Read buffer size.

Definition at line 158 of file remoteinputbuffer.h.

Referenced by readData().

◆ m_tvOut_sec

uint32_t RemoteInputBuffer::m_tvOut_sec
private

Estimated returned samples timestamp (seconds)

Definition at line 153 of file remoteinputbuffer.h.

Referenced by checkSlotData(), getTVOutMSec(), getTVOutSec(), and RemoteInputBuffer().

◆ m_tvOut_usec

uint32_t RemoteInputBuffer::m_tvOut_usec
private

Estimated returned samples timestamp (microseconds)

Definition at line 154 of file remoteinputbuffer.h.

Referenced by checkSlotData(), getTVOutMSec(), getTVOutUsec(), and RemoteInputBuffer().

◆ m_wrDeltaEstimate

int RemoteInputBuffer::m_wrDeltaEstimate
private

Sampled estimate of write to read indexes difference.

Definition at line 152 of file remoteinputbuffer.h.

Referenced by checkSlotData(), getBufferGauge(), initReadIndex(), and RemoteInputBuffer().

◆ nbDecoderSlots

const int RemoteInputBuffer::nbDecoderSlots = REMOTEINPUT_NBDECODERSLOTS
staticprivate

The documentation for this class was generated from the following files: