Skip to content

Commit 4d7a8e5

Browse files
DSheirerDennis Sheirer
andauthored
#1837 Channel Stream Thread Naming With Channel Config Number, Protocol and Frequency (#1838)
Co-authored-by: Dennis Sheirer <[email protected]>
1 parent aeeed71 commit 4d7a8e5

19 files changed

+125
-78
lines changed

src/main/java/io/github/dsheirer/controller/channel/ChannelProcessingManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,10 @@ private synchronized void startProcessing(ChannelStartProcessingRequest request)
382382

383383
try
384384
{
385+
String threadName = "sdrtrunk channel [" + channel.getChannelID() + "/" +
386+
channel.getDecodeConfiguration().getDecoderType().getShortDisplayString() + "]";
385387
source = mTunerManager.getSource(channel.getSourceConfiguration(),
386-
channel.getDecodeConfiguration().getChannelSpecification());
388+
channel.getDecodeConfiguration().getChannelSpecification(), threadName);
387389
}
388390
catch(SourceException se)
389391
{

src/main/java/io/github/dsheirer/dsp/filter/channelizer/PolyphaseChannelManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,10 @@ public double getChannelBandwidth()
189189
* Provides a Digital Drop Channel (DDC) for the specified tuner channel or returns null if the channel can't be
190190
* sourced due to the current center frequency and/or sample rate.
191191
* @param tunerChannel specifying center frequency and bandwidth.
192+
* @param threadName for the channel's dispatcher
192193
* @return source or null.
193194
*/
194-
public TunerChannelSource getChannel(TunerChannel tunerChannel)
195+
public TunerChannelSource getChannel(TunerChannel tunerChannel, String threadName)
195196
{
196197
PolyphaseChannelSource channelSource = null;
197198

@@ -200,7 +201,7 @@ public TunerChannelSource getChannel(TunerChannel tunerChannel)
200201
try
201202
{
202203
channelSource = new PolyphaseChannelSource(tunerChannel, mChannelCalculator, mFilterManager,
203-
mChannelSourceEventListener);
204+
mChannelSourceEventListener, threadName);
204205

205206
mChannelSources.add(channelSource);
206207
}

src/main/java/io/github/dsheirer/dsp/filter/channelizer/PolyphaseChannelSource.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* *****************************************************************************
3-
* Copyright (C) 2014-2023 Dennis Sheirer
3+
* Copyright (C) 2014-2024 Dennis Sheirer
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -56,12 +56,14 @@ public class PolyphaseChannelSource extends TunerChannelSource implements Listen
5656
* @param channelCalculator for current channel center frequency and sample rate and index calculations
5757
* @param filterManager for access to new or cached synthesis filters
5858
* @param producerSourceEventListener to receive source event requests (e.g. start/stop sample stream)
59+
* @param threadName for the channel's dispatcher
5960
* @throws IllegalArgumentException if a channel low pass filter can't be designed to the channel specification
6061
*/
6162
public PolyphaseChannelSource(TunerChannel tunerChannel, ChannelCalculator channelCalculator, SynthesisFilterManager filterManager,
62-
Listener<SourceEvent> producerSourceEventListener) throws IllegalArgumentException
63+
Listener<SourceEvent> producerSourceEventListener, String threadName)
64+
throws IllegalArgumentException
6365
{
64-
super(producerSourceEventListener, tunerChannel);
66+
super(producerSourceEventListener, tunerChannel, threadName);
6567
mChannelSampleRate = channelCalculator.getChannelSampleRate();
6668
doUpdateOutputProcessor(channelCalculator, filterManager);
6769
}
@@ -222,7 +224,7 @@ public void doUpdateOutputProcessor(ChannelCalculator channelCalculator, Synthes
222224
{
223225
case 1:
224226
mPolyphaseChannelOutputProcessor = new OneChannelOutputProcessor(channelCalculator.getChannelSampleRate(),
225-
indexes, channelCalculator.getChannelCount(), getHeartbeatManager());
227+
indexes, channelCalculator.getChannelCount(), getHeartbeatManager(), mThreadName);
226228
mPolyphaseChannelOutputProcessor.setListener(this);
227229
mPolyphaseChannelOutputProcessor.setFrequencyOffset(getFrequencyOffset());
228230
mPolyphaseChannelOutputProcessor.start();
@@ -233,7 +235,7 @@ public void doUpdateOutputProcessor(ChannelCalculator channelCalculator, Synthes
233235
float[] filter = filterManager.getFilter(channelCalculator.getChannelSampleRate(),
234236
channelCalculator.getChannelBandwidth(), 2);
235237
mPolyphaseChannelOutputProcessor = new TwoChannelOutputProcessor(channelCalculator.getChannelSampleRate(),
236-
indexes, filter, channelCalculator.getChannelCount(), getHeartbeatManager());
238+
indexes, filter, channelCalculator.getChannelCount(), getHeartbeatManager(), mThreadName);
237239
mPolyphaseChannelOutputProcessor.setListener(this);
238240
mPolyphaseChannelOutputProcessor.setFrequencyOffset(getFrequencyOffset());
239241
mPolyphaseChannelOutputProcessor.start();

src/main/java/io/github/dsheirer/dsp/filter/channelizer/output/ChannelOutputProcessor.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* *****************************************************************************
3-
* Copyright (C) 2014-2023 Dennis Sheirer
3+
* Copyright (C) 2014-2024 Dennis Sheirer
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -41,16 +41,15 @@ public abstract class ChannelOutputProcessor implements IPolyphaseChannelOutputP
4141
* oscillator support to apply frequency correction to the channel sample stream as requested by sample consumer.
4242
*
4343
* @param inputChannelCount is the number of input channels for this output processor
44-
* @param sampleRate of the output channel. This is used to match the oscillator's sample rate to the output
45-
* channel sample rate for frequency translation/correction.
4644
* @param heartbeatManager to receive pings on the dispatcher thread
45+
* @param threadName for the dispatcher
4746
*/
48-
public ChannelOutputProcessor(int inputChannelCount, double sampleRate, HeartbeatManager heartbeatManager)
47+
public ChannelOutputProcessor(int inputChannelCount, HeartbeatManager heartbeatManager, String threadName)
4948
{
5049
mInputChannelCount = inputChannelCount;
5150
//Process 1/10th of the sample rate per second at a rate of 20 times a second (200% of anticipated rate)
5251
mHeartbeatManager = heartbeatManager;
53-
mChannelResultsDispatcher = new Dispatcher("sdrtrunk polyphase channel",50, mHeartbeatManager);
52+
mChannelResultsDispatcher = new Dispatcher(threadName,50, mHeartbeatManager);
5453
mChannelResultsDispatcher.setListener(floats -> {
5554
try
5655
{

src/main/java/io/github/dsheirer/dsp/filter/channelizer/output/OneChannelOutputProcessor.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* *****************************************************************************
3-
* Copyright (C) 2014-2023 Dennis Sheirer
3+
* Copyright (C) 2014-2024 Dennis Sheirer
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -38,11 +38,12 @@ public class OneChannelOutputProcessor extends ChannelOutputProcessor
3838
* @param channelIndexes containing a single channel index.
3939
* @param gain value to apply. This is typically the same as the channelizer's channel count.
4040
* @param heartbeatManager to receive heartbeats on the dispatch thread
41+
* @param threadName to use for this processor
4142
*/
4243
public OneChannelOutputProcessor(double sampleRate, List<Integer> channelIndexes, float gain,
43-
HeartbeatManager heartbeatManager)
44+
HeartbeatManager heartbeatManager, String threadName)
4445
{
45-
super(1, sampleRate, heartbeatManager);
46+
super(1, heartbeatManager, threadName);
4647
setPolyphaseChannelIndices(channelIndexes);
4748
mMixerAssembler = new OneChannelMixerAssembler(gain);
4849
mMixerAssembler.getMixer().setSampleRate(sampleRate);

src/main/java/io/github/dsheirer/dsp/filter/channelizer/output/TwoChannelOutputProcessor.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* *****************************************************************************
3-
* Copyright (C) 2014-2023 Dennis Sheirer
3+
* Copyright (C) 2014-2024 Dennis Sheirer
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -37,15 +37,17 @@ public class TwoChannelOutputProcessor extends ChannelOutputProcessor
3737
*
3838
* @param sampleRate of the output sample stream.
3939
* @param channelIndexes containing two channel indices.
40+
* @param filter to use
4041
* @param gain to apply to output. Typically this is equal to the channelizer's channel count.
4142
* @param heartbeatManager to be pinged on the dispatcher thread
43+
* @param threadName for the dispatcher
4244
*/
4345
public TwoChannelOutputProcessor(double sampleRate, List<Integer> channelIndexes, float[] filter, float gain,
44-
HeartbeatManager heartbeatManager)
46+
HeartbeatManager heartbeatManager, String threadName)
4547
{
4648
//Set the frequency correction oscillator to 2 x output sample rate since we'll be correcting the frequency
4749
//after synthesizing both input channels
48-
super(2, sampleRate, heartbeatManager);
50+
super(2, heartbeatManager, threadName);
4951
setPolyphaseChannelIndices(channelIndexes);
5052
mMixerAssembler = new TwoChannelMixerAssembler(gain);
5153
mMixerAssembler.getMixer().setSampleRate(sampleRate);

src/main/java/io/github/dsheirer/gui/channelizer/ChannelizerViewer.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* *****************************************************************************
3-
* Copyright (C) 2014-2022 Dennis Sheirer
3+
* Copyright (C) 2014-2024 Dennis Sheirer
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -35,6 +35,13 @@
3535
import io.github.dsheirer.spectrum.DFTSize;
3636
import io.github.dsheirer.spectrum.SpectrumPanel;
3737
import io.github.dsheirer.spectrum.converter.ComplexDecibelConverter;
38+
import java.awt.Dimension;
39+
import java.awt.EventQueue;
40+
import java.awt.event.ActionEvent;
41+
import java.awt.event.ActionListener;
42+
import java.util.ArrayList;
43+
import java.util.Arrays;
44+
import java.util.List;
3845
import net.miginfocom.swing.MigLayout;
3946
import org.slf4j.Logger;
4047
import org.slf4j.LoggerFactory;
@@ -47,13 +54,6 @@
4754
import javax.swing.SpinnerNumberModel;
4855
import javax.swing.event.ChangeEvent;
4956
import javax.swing.event.ChangeListener;
50-
import java.awt.Dimension;
51-
import java.awt.EventQueue;
52-
import java.awt.event.ActionEvent;
53-
import java.awt.event.ActionListener;
54-
import java.util.ArrayList;
55-
import java.util.Arrays;
56-
import java.util.List;
5757

5858
public class ChannelizerViewer extends JFrame
5959
{
@@ -262,7 +262,7 @@ private void init()
262262
for(int x = 0; x < mChannelCount; x++)
263263
{
264264
TunerChannel tunerChannel = new TunerChannel(100000000, 12500);
265-
TunerChannelSource source = mTestTuner.getChannelSourceManager().getSource(tunerChannel, null);
265+
TunerChannelSource source = mTestTuner.getChannelSourceManager().getSource(tunerChannel, null, "test");
266266
DiscreteChannelPanel channelPanel = new DiscreteChannelPanel(mSettingsManager, source, x);
267267
channelPanel.setDFTSize(mChannelPanelDFTSize);
268268

@@ -362,7 +362,7 @@ public ChannelPanel(SettingsManager settingsManager, double sampleRate, long fre
362362
mComplexDecibelConverter.addListener(mSpectrumPanel);
363363

364364
TunerChannel tunerChannel = new TunerChannel(frequency, bandwidth);
365-
mSource = mTestTuner.getChannelSourceManager().getSource(tunerChannel, null);
365+
mSource = mTestTuner.getChannelSourceManager().getSource(tunerChannel, null, "test");
366366

367367
if(mSource != null)
368368
{
@@ -535,7 +535,7 @@ public void run()
535535
{
536536
if(sourceCount < maxSourceCount)
537537
{
538-
TunerChannelSource source = tuner.getChannelSourceManager().getSource(tunerChannel, null);
538+
TunerChannelSource source = tuner.getChannelSourceManager().getSource(tunerChannel, null, "test");
539539

540540
if(source != null)
541541
{

src/main/java/io/github/dsheirer/gui/channelizer/ChannelizerViewer2.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* *****************************************************************************
3-
* Copyright (C) 2014-2023 Dennis Sheirer
3+
* Copyright (C) 2014-2024 Dennis Sheirer
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -379,7 +379,8 @@ public ChannelPanel(SettingsManager settingsManager, double sampleRate, long fre
379379
mComplexDecibelConverter.addListener(mSpectrumPanel);
380380

381381
TunerChannel tunerChannel = new TunerChannel(frequency, bandwidth);
382-
mSource = mTestTuner.getChannelSourceManager().getSource(tunerChannel, new ChannelSpecification(50000, 12500, 6000, 7000));
382+
mSource = mTestTuner.getChannelSourceManager().getSource(tunerChannel,
383+
new ChannelSpecification(50000, 12500, 6000, 7000), "test");
383384

384385
if(mSource != null)
385386
{

src/main/java/io/github/dsheirer/gui/channelizer/HeterodyneChannelizerViewer.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* *****************************************************************************
3-
* Copyright (C) 2014-2022 Dennis Sheirer
3+
* Copyright (C) 2014-2024 Dennis Sheirer
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -36,6 +36,13 @@
3636
import io.github.dsheirer.spectrum.DFTSize;
3737
import io.github.dsheirer.spectrum.SpectrumPanel;
3838
import io.github.dsheirer.spectrum.converter.ComplexDecibelConverter;
39+
import java.awt.Dimension;
40+
import java.awt.EventQueue;
41+
import java.awt.event.ActionEvent;
42+
import java.awt.event.ActionListener;
43+
import java.util.ArrayList;
44+
import java.util.Arrays;
45+
import java.util.List;
3946
import net.miginfocom.swing.MigLayout;
4047
import org.slf4j.Logger;
4148
import org.slf4j.LoggerFactory;
@@ -48,13 +55,6 @@
4855
import javax.swing.SpinnerNumberModel;
4956
import javax.swing.event.ChangeEvent;
5057
import javax.swing.event.ChangeListener;
51-
import java.awt.Dimension;
52-
import java.awt.EventQueue;
53-
import java.awt.event.ActionEvent;
54-
import java.awt.event.ActionListener;
55-
import java.util.ArrayList;
56-
import java.util.Arrays;
57-
import java.util.List;
5858

5959
public class HeterodyneChannelizerViewer extends JFrame
6060
{
@@ -261,7 +261,8 @@ private void init()
261261
for(int x = 0; x < mChannelCount; x++)
262262
{
263263
TunerChannel tunerChannel = new TunerChannel(100000000, 12500);
264-
TunerChannelSource source = mTestTuner.getChannelSourceManager().getSource(tunerChannel, channelSpecification);
264+
TunerChannelSource source = mTestTuner.getChannelSourceManager().getSource(tunerChannel,
265+
channelSpecification, "test");
265266
DiscreteChannelPanel channelPanel = new DiscreteChannelPanel(mSettingsManager, source, x);
266267
channelPanel.setDFTSize(mChannelPanelDFTSize);
267268

@@ -362,7 +363,7 @@ public ChannelPanel(SettingsManager settingsManager, double sampleRate, long fre
362363

363364
TunerChannel tunerChannel = new TunerChannel(frequency, bandwidth);
364365
ChannelSpecification channelSpecification = new ChannelSpecification(25000.0, 12500, 6000.0, 6250.0);
365-
mSource = mTestTuner.getChannelSourceManager().getSource(tunerChannel, channelSpecification);
366+
mSource = mTestTuner.getChannelSourceManager().getSource(tunerChannel, channelSpecification, "test");
366367

367368
if(mSource != null)
368369
{
@@ -533,7 +534,8 @@ public void run()
533534
{
534535
if(sourceCount < maxSourceCount)
535536
{
536-
TunerChannelSource source = tuner.getChannelSourceManager().getSource(tunerChannel, null);
537+
TunerChannelSource source = tuner.getChannelSourceManager().getSource(tunerChannel,
538+
null, "test");
537539

538540
if(source != null)
539541
{

src/main/java/io/github/dsheirer/source/tuner/channel/HalfBandTunerChannelSource.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* *****************************************************************************
3-
* Copyright (C) 2014-2023 Dennis Sheirer
3+
* Copyright (C) 2014-2024 Dennis Sheirer
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -59,13 +59,15 @@ public class HalfBandTunerChannelSource<T extends INativeBuffer> extends TunerCh
5959
* @param tunerChannel that details the desired channel frequency and bandwidth
6060
* @param sampleRate of the incoming sample stream
6161
* @param channelSpecification for the requested channel.
62+
* @param threadName for the dispatcher
6263
* @throws FilterDesignException if a final cleanup filter cannot be designed using the remez filter
6364
* designer and the filter parameters.
6465
*/
6566
public HalfBandTunerChannelSource(Listener<SourceEvent> producerSourceEventListener, TunerChannel tunerChannel,
66-
double sampleRate, ChannelSpecification channelSpecification) throws FilterDesignException
67+
double sampleRate, ChannelSpecification channelSpecification, String threadName)
68+
throws FilterDesignException
6769
{
68-
super(producerSourceEventListener, tunerChannel);
70+
super(producerSourceEventListener, tunerChannel, threadName);
6971

7072
int desiredDecimation = (int)(sampleRate / channelSpecification.getMinimumSampleRate());
7173
int decimation = DecimationFilterFactory.getDecimationRate(desiredDecimation);
@@ -74,7 +76,7 @@ public HalfBandTunerChannelSource(Listener<SourceEvent> producerSourceEventListe
7476
mQDecimationFilter = DecimationFilterFactory.getRealDecimationFilter(decimation);
7577

7678
//Set dispatcher to process 1/10 of estimated sample arrival rate, 20 times per second (up to 200% per interval)
77-
mBufferDispatcher = new Dispatcher("sdrtrunk heterodyne channel " + tunerChannel.getFrequency(), 50, getHeartbeatManager());
79+
mBufferDispatcher = new Dispatcher(threadName, 50, getHeartbeatManager());
7880
mBufferDispatcher.setListener(new NativeBufferProcessor());
7981

8082
//Setup the frequency mixer to the current source frequency

src/main/java/io/github/dsheirer/source/tuner/channel/MultiFrequencyTunerChannelSource.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* *****************************************************************************
3-
* Copyright (C) 2014-2023 Dennis Sheirer
3+
* Copyright (C) 2014-2024 Dennis Sheirer
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -60,9 +60,9 @@ public class MultiFrequencyTunerChannelSource extends TunerChannelSource
6060

6161
public MultiFrequencyTunerChannelSource(TunerManager tunerManager, TunerChannelSource tunerChannelSource,
6262
List<Long> frequencies, ChannelSpecification channelSpecification,
63-
String preferredTuner)
63+
String preferredTuner, String threadName)
6464
{
65-
super(null, tunerChannelSource.getTunerChannel());
65+
super(null, tunerChannelSource.getTunerChannel(), threadName);
6666
mTunerManager = tunerManager;
6767
mTunerChannelSource = tunerChannelSource;
6868
mTunerChannelSource.setSourceEventListener(mConsumerSourceEventAdapter);
@@ -114,7 +114,7 @@ private void getNextSource(TunerChannel nextChannel)
114114
{
115115
if(mStarted)
116116
{
117-
Source source = mTunerManager.getSource(nextChannel, mChannelSpecification, mPreferredTuner);
117+
Source source = mTunerManager.getSource(nextChannel, mChannelSpecification, mPreferredTuner, mThreadName);
118118

119119
if(source instanceof TunerChannelSource)
120120
{

0 commit comments

Comments
 (0)