From 877690834098f89607142cba1834cb99f79ffcc2 Mon Sep 17 00:00:00 2001 From: vsonnier Date: Tue, 23 May 2017 11:06:17 +0200 Subject: [PATCH] Fixes #546, when MTU > nb samples per-frame, overflow management was wrong. --- src/sdr/SoapySDRThread.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sdr/SoapySDRThread.cpp b/src/sdr/SoapySDRThread.cpp index 0054015..adb4eb9 100644 --- a/src/sdr/SoapySDRThread.cpp +++ b/src/sdr/SoapySDRThread.cpp @@ -222,14 +222,15 @@ void SDRThread::readStream(SDRThreadIQDataQueue* iqDataOutQueue) { ::memcpy(&dataOut->data[0], &overflowBuffer.data[0], n_overflow * sizeof(liquid_float_complex)); n_read = n_overflow; - numOverflow = std::min(0, numOverflow - n_overflow); + //is still > 0 if MTU > nElements (low sample rate w.r.t the MTU !) + numOverflow -= n_overflow; // std::cout << "SDRThread::readStream() 1.1 overflowBuffer not empty, collect the remaining " << n_overflow << " samples in it..." << std::endl; if (numOverflow > 0) { // still some left, shift the remaining samples to the begining.. ::memmove(&overflowBuffer.data[0], &overflowBuffer.data[n_overflow], numOverflow * sizeof(liquid_float_complex)); - std::cout << "SDRThread::readStream() 1.2 overflowBuffer still not empty, compact the remaining " << numOverflow << " samples in it..." << std::endl; + // std::cout << "SDRThread::readStream() 1.2 overflowBuffer still not empty, compact the remaining " << numOverflow << " samples in it..." << std::endl; } } //end if numOverflow > 0