1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 21:54:55 -04:00

Fix USRP TX buffer handling for high interpolation

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:
copilot-swe-agent[bot]
2026-04-21 19:54:56 +00:00
committed by GitHub
parent 82b43ff2f4
commit 788673891d
@@ -41,7 +41,7 @@ USRPOutputThread::USRPOutputThread(uhd::tx_streamer::sptr stream, size_t bufSamp
USRPOutputThread::~USRPOutputThread()
{
stopWork();
delete m_buf;
delete[] m_buf;
}
void USRPOutputThread::startWork()
@@ -123,6 +123,10 @@ void USRPOutputThread::run()
// Interpolate according to specified log2 (ex: log2=4 => decim=16)
void USRPOutputThread::callback(qint16* buf, qint32 len)
{
// Fill any sample tail not overwritten by interpolation (for non power-of-two streamer block sizes)
// so stale data is never transmitted.
std::fill(buf, buf + (2 * len), 0);
SampleVector& data = m_sampleFifo->getData();
unsigned int iPart1Begin, iPart1End, iPart2Begin, iPart2End;
m_sampleFifo->read(len/(1<<m_log2Interp), iPart1Begin, iPart1End, iPart2Begin, iPart2End);