Usrp1_source_base, usrp_standard_rx::read, and 512 nbytes


#1

usrp1_source_base.cc has this chunk of code that reads from
usrp_standard_rx:

//----------
while (output_index < noutput_items)
{
int nbytes = ninput_bytes_reqd_for_noutput_items (
noutput_items - output_index);

nbytes = std::min (nbytes, BUFSIZE);

int result_nbytes = d_usrp->read (buf, nbytes, &overrun);
//----------

Question: What guarantees that nbytes is a multiple of 512?

According to usrp_basic.h, nbytes must be a multiple of 512. It seems
to me that nouput_items would need to be specially crafted upstream so
that nbytes is a multiple of 512.

Thank you,

Chris


#2

On Wed, 2008-12-10 at 12:37 -0800, Chris S. wrote:

int result_nbytes = d_usrp->read (buf, nbytes, &overrun);
//----------

Question: What guarantees that nbytes is a multiple of 512?

In the usrp1_source_base constructor, a call is made to
set_output_multiple(n), which tells the scheduler to only call the work
function to produce a multiple of n samples:

http://gnuradio.org/trac/browser/gnuradio/trunk/gr-usrp/src/usrp1_source_base.cc#L63

-Johnathan