mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-09 15:17:24 -05:00
Resolves #58 - DFT processor sample queue may fill up over time causing
the spectral display to be slow to reflect changes to tuner settings. Changed the max size of the sample queue based on the highest rate tuner sample rate 10 MHz (airspy) and the lowest available spectral update frame rate (12). Sized the buffer queue based on the maximum number of buffers that should be available per DFT processing iteration. If the queue backs up, new buffers will be discarded until the DFT processor consumes the queue and catches up.
This commit is contained in:
@@ -20,6 +20,7 @@ package spectrum;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
@@ -56,8 +57,12 @@ public class DFTProcessor implements Listener<ComplexBuffer>,
|
||||
private CopyOnWriteArrayList<DFTResultsConverter> mListeners =
|
||||
new CopyOnWriteArrayList<DFTResultsConverter>();
|
||||
|
||||
private ArrayBlockingQueue<ComplexBuffer> mQueue =
|
||||
new ArrayBlockingQueue<ComplexBuffer>( 200 );
|
||||
//Fixed size sample queue. We set the size at 12 based on the highest
|
||||
//sample rate tuner (10 MHz) producing 153 frames per second and the lowest
|
||||
//DFT processing frame rate of 12 frames per second. This means that the
|
||||
//maximum size needed is 153 / 12 = 11 frames per DFT processing iteration
|
||||
//so we set it at 12.
|
||||
private BlockingQueue<ComplexBuffer> mQueue = new ArrayBlockingQueue<>( 12 );
|
||||
|
||||
private ScheduledExecutorService mScheduler = Executors
|
||||
.newScheduledThreadPool( 1, new NamingThreadFactory( "spectrum dft" ) );
|
||||
|
||||
Reference in New Issue
Block a user