Merge pull request #414 from DSheirer/405-airspy-tuner-waterfall-freeze

405 Airspy Spectrum/Waterfall Freezes
This commit is contained in:
Denny Sheirer
2018-09-12 06:20:36 -04:00
committed by GitHub
3 changed files with 26 additions and 2 deletions

View File

@@ -71,6 +71,10 @@ public class TunerManager
*/
public void dispose()
{
mLog.info("Shutting down LibUsb timeout processor ...");
LIBUSB_TRANSFER_PROCESSOR.shutdown();
mLog.info("Shutting down LibUsb ...");
try
{

View File

@@ -27,6 +27,7 @@ import io.github.dsheirer.source.tuner.channel.TunerChannelSource;
import io.github.dsheirer.source.tuner.configuration.TunerConfiguration;
import io.github.dsheirer.source.tuner.configuration.TunerConfigurationModel;
import io.github.dsheirer.spectrum.SpectralDisplayPanel;
import io.github.dsheirer.util.ThreadPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,6 +36,7 @@ import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
public class TunerModel extends AbstractTableModel implements Listener<TunerEvent>
{
@@ -202,7 +204,17 @@ public class TunerModel extends AbstractTableModel implements Listener<TunerEven
if(enabled && mTuners.size() > 0)
{
broadcast(new TunerEvent(mTuners.get(0), Event.REQUEST_MAIN_SPECTRAL_DISPLAY));
//Hack: the airspy tuner would lockup aperiodically and refuse to produce
//transfer buffers ... delaying registering for buffers for 500 ms seems
//to allow the airspy to stabilize before we start asking for samples.
ThreadPool.SCHEDULED.schedule(new Runnable()
{
@Override
public void run()
{
broadcast(new TunerEvent(mTuners.get(0), Event.REQUEST_MAIN_SPECTRAL_DISPLAY));
}
}, 500, TimeUnit.MILLISECONDS);
}
else
{

View File

@@ -81,7 +81,7 @@ public class USBMasterProcessor
if(mRunning.compareAndSet(false, true))
{
//Set periodicity to an odd multiple to avoid contention with transfer buffer receivers
mProcessorFuture = ThreadPool.SCHEDULED.scheduleAtFixedRate(mProcessor, 0L, 5L, TimeUnit.MILLISECONDS);
mProcessorFuture = ThreadPool.SCHEDULED.scheduleAtFixedRate(mProcessor, 0L, 9L, TimeUnit.MILLISECONDS);
}
}
@@ -100,6 +100,14 @@ public class USBMasterProcessor
}
}
/**
* Stops the libusb timeout processor and prepares for shutdown.
*/
public void shutdown()
{
stop();
}
/**
* Runnable to invoke LibUSB timeout handler. All downstream completed transfer processing will occur on this
* thread instance.