radioInterface: Clarify how underruns are handled driving a radioDevice

The underrun parameter in radioDevice's readSamples() is not a "Rx
Underrun" event, but rather it's used to retrieve a "Tx Underrun" which
on some SDRs (like USRP1) seems to be (so far) available only at
readSamples() times.

Thus, underrun parameter for both readSamples() and writeSamples() is
actually flagging the same event, and should be ORed in pushBuffer() as
it's already done in pullBuffer(). Otherwise if implementation is
setting the underrun pointer to false, it could erase the flag being
marked by the counterpart function before isUnderrun() is called (which
is the one responsible to clear the flag).

Change-Id: Id549489fc1485e0d762818c8e682aaddd5041f1c
This commit is contained in:
Pau Espin 2019-07-29 20:14:47 +02:00
parent b4c749b32b
commit 2c673e0f3e
1 changed files with 3 additions and 1 deletions

View File

@ -348,6 +348,7 @@ int RadioInterface::pullBuffer()
/* Send timestamped chunk to the device with arbitrary size */
bool RadioInterface::pushBuffer()
{
bool local_underrun;
size_t numSent, segmentLen = sendBuffer[0]->getSegmentLen();
if (sendBuffer[0]->getAvailSegments() < 1)
@ -363,8 +364,9 @@ bool RadioInterface::pushBuffer()
/* Send the all samples in the send buffer */
numSent = mRadio->writeSamples(convertSendBuffer,
segmentLen,
&underrun,
&local_underrun,
writeTimestamp);
underrun |= local_underrun;
writeTimestamp += numSent;
return true;