kopia lustrzana https://github.com/f4exb/sdrangel
Sample source FIFO: limit read count to FIFO size
rodzic
55d43c2e03
commit
6533df15f5
|
@ -62,7 +62,7 @@ void SampleSourceFifo::read(
|
|||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
unsigned int spaceLeft = m_size - m_readHead;
|
||||
m_readCount += amount;
|
||||
m_readCount = m_readCount + amount < m_size ? m_readCount + amount : m_size; // cannot exceed FIFO size
|
||||
|
||||
if (amount <= spaceLeft)
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ void SampleSourceFifo::write(
|
|||
m_writeHead = remaining;
|
||||
}
|
||||
|
||||
m_readCount = amount < m_readCount ? m_readCount - amount : 0;
|
||||
m_readCount = amount < m_readCount ? m_readCount - amount : 0; // cannot be less than 0
|
||||
}
|
||||
|
||||
unsigned int SampleSourceFifo::getSizePolicy(unsigned int sampleRate)
|
||||
|
|
Ładowanie…
Reference in New Issue