SoapySDR: Process number of elements that actually were returned, not requested

This commit is contained in:
Kacper Michajłow 2021-02-06 20:31:41 +01:00
parent 3388e385b6
commit 21255f8d82
1 changed files with 10 additions and 10 deletions

View File

@ -160,24 +160,24 @@ void SoapySDRInputThread::run()
{ {
if (m_nbChannels > 1) if (m_nbChannels > 1)
{ {
callbackMIIQ(buffs, numElems*2); // size given in number of I or Q samples (2 items per sample) callbackMIIQ(buffs, ret*2); // size given in number of I or Q samples (2 items per sample)
} }
else else
{ {
switch (m_decimatorType) switch (m_decimatorType)
{ {
case Decimator8: case Decimator8:
callbackSI8IQ((const qint8*) buffs[0], numElems*2); callbackSI8IQ((const qint8*) buffs[0], ret*2);
break; break;
case Decimator12: case Decimator12:
callbackSI12IQ((const qint16*) buffs[0], numElems*2); callbackSI12IQ((const qint16*) buffs[0], ret*2);
break; break;
case Decimator16: case Decimator16:
callbackSI16IQ((const qint16*) buffs[0], numElems*2); callbackSI16IQ((const qint16*) buffs[0], ret*2);
break; break;
case DecimatorFloat: case DecimatorFloat:
default: default:
callbackSIFIQ((const float*) buffs[0], numElems*2); callbackSIFIQ((const float*) buffs[0], ret*2);
} }
} }
} }
@ -185,24 +185,24 @@ void SoapySDRInputThread::run()
{ {
if (m_nbChannels > 1) if (m_nbChannels > 1)
{ {
callbackMIQI(buffs, numElems*2); // size given in number of I or Q samples (2 items per sample) callbackMIQI(buffs, ret*2); // size given in number of I or Q samples (2 items per sample)
} }
else else
{ {
switch (m_decimatorType) switch (m_decimatorType)
{ {
case Decimator8: case Decimator8:
callbackSI8QI((const qint8*) buffs[0], numElems*2); callbackSI8QI((const qint8*) buffs[0], ret*2);
break; break;
case Decimator12: case Decimator12:
callbackSI12QI((const qint16*) buffs[0], numElems*2); callbackSI12QI((const qint16*) buffs[0], ret*2);
break; break;
case Decimator16: case Decimator16:
callbackSI16QI((const qint16*) buffs[0], numElems*2); callbackSI16QI((const qint16*) buffs[0], ret*2);
break; break;
case DecimatorFloat: case DecimatorFloat:
default: default:
callbackSIFQI((const float*) buffs[0], numElems*2); callbackSIFQI((const float*) buffs[0], ret*2);
} }
} }
} }