Fix RX streaming space required calculation #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The calculation to compute the space required to store the users samples is
double what it should be.
An example of how this can manifest from the users perspective, the Sidekiq SDR
reads 2036 samples of type
int16_t
/float
, the internal Soapy Sidekiq bufferwill be resized to twice what is needed, samples are written to the first half
of the buffer, the 2nd half is all zeros. If you dump the samples received
from
SoapySidekiq::readStream
, you would see a pattern of 2036 samplesfollowed by 2036 samples consisting of zeros.
Instead, the
space_req
should be in terms of the number of 'samples' whichare I & Q samples.
There was a bit of confusion on my part as to what a sample represented. A
sample represents a single I or Q value. Something like a
std::complex<float>
, which I initially assumed was a 'sample' is insteadreferred to as an
elem
orelements
in this code. Not a criticism but itseems like different code bases represent a 'sample' differently.
This change was tested with:
int16_t
(Soapy CS16) andfloat
(Soapy CF32)There are 3 additional unrelated changes in this commit:
elementsPerSample
inmemcpy
buffer sizecalculation.
as milliseconds unit name (ms).