mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-05-16 06:12:29 -04:00
Document intentional signed length and FIFO truncation behavior
Agent-Logs-Url: https://github.com/srcejon/sdrangel/sessions/bafbe6fb-a6ec-4ee0-92f8-caa27da815f5 Co-authored-by: srcejon <57259258+srcejon@users.noreply.github.com>
This commit is contained in:
parent
ebbfd76504
commit
a4462cfa40
@ -123,6 +123,7 @@ void USRPOutputThread::run()
|
||||
// Interpolate according to specified log2 (ex: log2=4 => decim=16)
|
||||
void USRPOutputThread::callback(qint16* buf, qint32 len)
|
||||
{
|
||||
// Keep signed length to match callback interfaces used by other output threads.
|
||||
if (len <= 0) {
|
||||
return;
|
||||
}
|
||||
@ -130,6 +131,7 @@ void USRPOutputThread::callback(qint16* buf, qint32 len)
|
||||
const unsigned int interpolationFactor = 1U << m_log2Interp;
|
||||
SampleVector& data = m_sampleFifo->getData();
|
||||
unsigned int iPart1Begin, iPart1End, iPart2Begin, iPart2End;
|
||||
// Truncation is intentional here: reading more would overrun the fixed TX buffer when len is not divisible by interpolation factor.
|
||||
m_sampleFifo->read(static_cast<unsigned int>(len)/interpolationFactor, iPart1Begin, iPart1End, iPart2Begin, iPart2End);
|
||||
|
||||
if (iPart1Begin != iPart1End) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user