This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/osmocom-sdr@lists.osmocom.org/.
Anton Blanchard anton at ozlabs.orgHi Sylvain, On Thu, 16 Apr 2020 09:30:31 +1000 Anton Blanchard <anton at ozlabs.org> wrote: > Hi Sylvain, > > > Looks to me like this has the potential to just hang and prevent the > > thread from terminating. > > This needs bounds. One retry is fine, infinite ones not so much. > > Good idea, how does this look? Just checking to see if this is OK to be merged? Thanks, Anton > Anton > -- > > I'm using an Airspy HF+ Discovery with the Soapy driver. Whenever I > turn AGC off it stops receiving samples. > > On closer inspection, switching AGC off results in samples stalling > for an extended period (hundreds of milliseconds). As such, we hit the > timeout in SoapyAirspyHF::readStream() and return SOAPY_SDR_TIMEOUT > (-1). > > Things go wrong at this point. It takes a long time before > readStream() is called again, presumably because we returned 0 from > work(). By this time our buffers have overflown, readStream() returns > SOAPY_SDR_OVERFLOW (-2) and work() returns 0. We loop forever, > continually overflowing buffers. > > Fix this by looping in soapy_source_c::work() when ->readStream > returns SOAPY_SDR_OVERFLOW so that we consume the buffers straight > away. > > Signed-off-by: Anton Blanchard <anton at ozlabs.org> > --- > lib/soapy/soapy_source_c.cc | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/lib/soapy/soapy_source_c.cc b/lib/soapy/soapy_source_c.cc > index a645361..5c683c9 100644 > --- a/lib/soapy/soapy_source_c.cc > +++ b/lib/soapy/soapy_source_c.cc > @@ -96,9 +96,14 @@ int soapy_source_c::work( int noutput_items, > { > int flags = 0; > long long timeNs = 0; > - int ret = _device->readStream( > - _stream, &output_items[0], > - noutput_items, flags, timeNs); > + int ret; > + int retries = 1; > + > + do { > + ret = _device->readStream( > + _stream, &output_items[0], > + noutput_items, flags, timeNs); > + } while (retries-- && (ret == SOAPY_SDR_OVERFLOW)); > > if (ret < 0) return 0; //call again > return ret;