#1837 Channel Stream Thread Naming With Channel Config Number, Protocol and Frequency (#1838)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2024-02-10 07:30:33 -05:00
committed by GitHub
parent aeeed71231
commit 4d7a8e5980
19 changed files with 125 additions and 78 deletions

View File

@@ -382,8 +382,10 @@ public class ChannelProcessingManager implements Listener<ChannelEvent>
try try
{ {
String threadName = "sdrtrunk channel [" + channel.getChannelID() + "/" +
channel.getDecodeConfiguration().getDecoderType().getShortDisplayString() + "]";
source = mTunerManager.getSource(channel.getSourceConfiguration(), source = mTunerManager.getSource(channel.getSourceConfiguration(),
channel.getDecodeConfiguration().getChannelSpecification()); channel.getDecodeConfiguration().getChannelSpecification(), threadName);
} }
catch(SourceException se) catch(SourceException se)
{ {

View File

@@ -189,9 +189,10 @@ public class PolyphaseChannelManager implements ISourceEventProcessor
* Provides a Digital Drop Channel (DDC) for the specified tuner channel or returns null if the channel can't be * Provides a Digital Drop Channel (DDC) for the specified tuner channel or returns null if the channel can't be
* sourced due to the current center frequency and/or sample rate. * sourced due to the current center frequency and/or sample rate.
* @param tunerChannel specifying center frequency and bandwidth. * @param tunerChannel specifying center frequency and bandwidth.
* @param threadName for the channel's dispatcher
* @return source or null. * @return source or null.
*/ */
public TunerChannelSource getChannel(TunerChannel tunerChannel) public TunerChannelSource getChannel(TunerChannel tunerChannel, String threadName)
{ {
PolyphaseChannelSource channelSource = null; PolyphaseChannelSource channelSource = null;
@@ -200,7 +201,7 @@ public class PolyphaseChannelManager implements ISourceEventProcessor
try try
{ {
channelSource = new PolyphaseChannelSource(tunerChannel, mChannelCalculator, mFilterManager, channelSource = new PolyphaseChannelSource(tunerChannel, mChannelCalculator, mFilterManager,
mChannelSourceEventListener); mChannelSourceEventListener, threadName);
mChannelSources.add(channelSource); mChannelSources.add(channelSource);
} }

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer * Copyright (C) 2014-2024 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -56,12 +56,14 @@ public class PolyphaseChannelSource extends TunerChannelSource implements Listen
* @param channelCalculator for current channel center frequency and sample rate and index calculations * @param channelCalculator for current channel center frequency and sample rate and index calculations
* @param filterManager for access to new or cached synthesis filters * @param filterManager for access to new or cached synthesis filters
* @param producerSourceEventListener to receive source event requests (e.g. start/stop sample stream) * @param producerSourceEventListener to receive source event requests (e.g. start/stop sample stream)
* @param threadName for the channel's dispatcher
* @throws IllegalArgumentException if a channel low pass filter can't be designed to the channel specification * @throws IllegalArgumentException if a channel low pass filter can't be designed to the channel specification
*/ */
public PolyphaseChannelSource(TunerChannel tunerChannel, ChannelCalculator channelCalculator, SynthesisFilterManager filterManager, public PolyphaseChannelSource(TunerChannel tunerChannel, ChannelCalculator channelCalculator, SynthesisFilterManager filterManager,
Listener<SourceEvent> producerSourceEventListener) throws IllegalArgumentException Listener<SourceEvent> producerSourceEventListener, String threadName)
throws IllegalArgumentException
{ {
super(producerSourceEventListener, tunerChannel); super(producerSourceEventListener, tunerChannel, threadName);
mChannelSampleRate = channelCalculator.getChannelSampleRate(); mChannelSampleRate = channelCalculator.getChannelSampleRate();
doUpdateOutputProcessor(channelCalculator, filterManager); doUpdateOutputProcessor(channelCalculator, filterManager);
} }
@@ -222,7 +224,7 @@ public class PolyphaseChannelSource extends TunerChannelSource implements Listen
{ {
case 1: case 1:
mPolyphaseChannelOutputProcessor = new OneChannelOutputProcessor(channelCalculator.getChannelSampleRate(), mPolyphaseChannelOutputProcessor = new OneChannelOutputProcessor(channelCalculator.getChannelSampleRate(),
indexes, channelCalculator.getChannelCount(), getHeartbeatManager()); indexes, channelCalculator.getChannelCount(), getHeartbeatManager(), mThreadName);
mPolyphaseChannelOutputProcessor.setListener(this); mPolyphaseChannelOutputProcessor.setListener(this);
mPolyphaseChannelOutputProcessor.setFrequencyOffset(getFrequencyOffset()); mPolyphaseChannelOutputProcessor.setFrequencyOffset(getFrequencyOffset());
mPolyphaseChannelOutputProcessor.start(); mPolyphaseChannelOutputProcessor.start();
@@ -233,7 +235,7 @@ public class PolyphaseChannelSource extends TunerChannelSource implements Listen
float[] filter = filterManager.getFilter(channelCalculator.getChannelSampleRate(), float[] filter = filterManager.getFilter(channelCalculator.getChannelSampleRate(),
channelCalculator.getChannelBandwidth(), 2); channelCalculator.getChannelBandwidth(), 2);
mPolyphaseChannelOutputProcessor = new TwoChannelOutputProcessor(channelCalculator.getChannelSampleRate(), mPolyphaseChannelOutputProcessor = new TwoChannelOutputProcessor(channelCalculator.getChannelSampleRate(),
indexes, filter, channelCalculator.getChannelCount(), getHeartbeatManager()); indexes, filter, channelCalculator.getChannelCount(), getHeartbeatManager(), mThreadName);
mPolyphaseChannelOutputProcessor.setListener(this); mPolyphaseChannelOutputProcessor.setListener(this);
mPolyphaseChannelOutputProcessor.setFrequencyOffset(getFrequencyOffset()); mPolyphaseChannelOutputProcessor.setFrequencyOffset(getFrequencyOffset());
mPolyphaseChannelOutputProcessor.start(); mPolyphaseChannelOutputProcessor.start();

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer * Copyright (C) 2014-2024 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -41,16 +41,15 @@ public abstract class ChannelOutputProcessor implements IPolyphaseChannelOutputP
* oscillator support to apply frequency correction to the channel sample stream as requested by sample consumer. * oscillator support to apply frequency correction to the channel sample stream as requested by sample consumer.
* *
* @param inputChannelCount is the number of input channels for this output processor * @param inputChannelCount is the number of input channels for this output processor
* @param sampleRate of the output channel. This is used to match the oscillator's sample rate to the output
* channel sample rate for frequency translation/correction.
* @param heartbeatManager to receive pings on the dispatcher thread * @param heartbeatManager to receive pings on the dispatcher thread
* @param threadName for the dispatcher
*/ */
public ChannelOutputProcessor(int inputChannelCount, double sampleRate, HeartbeatManager heartbeatManager) public ChannelOutputProcessor(int inputChannelCount, HeartbeatManager heartbeatManager, String threadName)
{ {
mInputChannelCount = inputChannelCount; mInputChannelCount = inputChannelCount;
//Process 1/10th of the sample rate per second at a rate of 20 times a second (200% of anticipated rate) //Process 1/10th of the sample rate per second at a rate of 20 times a second (200% of anticipated rate)
mHeartbeatManager = heartbeatManager; mHeartbeatManager = heartbeatManager;
mChannelResultsDispatcher = new Dispatcher("sdrtrunk polyphase channel",50, mHeartbeatManager); mChannelResultsDispatcher = new Dispatcher(threadName,50, mHeartbeatManager);
mChannelResultsDispatcher.setListener(floats -> { mChannelResultsDispatcher.setListener(floats -> {
try try
{ {

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer * Copyright (C) 2014-2024 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -38,11 +38,12 @@ public class OneChannelOutputProcessor extends ChannelOutputProcessor
* @param channelIndexes containing a single channel index. * @param channelIndexes containing a single channel index.
* @param gain value to apply. This is typically the same as the channelizer's channel count. * @param gain value to apply. This is typically the same as the channelizer's channel count.
* @param heartbeatManager to receive heartbeats on the dispatch thread * @param heartbeatManager to receive heartbeats on the dispatch thread
* @param threadName to use for this processor
*/ */
public OneChannelOutputProcessor(double sampleRate, List<Integer> channelIndexes, float gain, public OneChannelOutputProcessor(double sampleRate, List<Integer> channelIndexes, float gain,
HeartbeatManager heartbeatManager) HeartbeatManager heartbeatManager, String threadName)
{ {
super(1, sampleRate, heartbeatManager); super(1, heartbeatManager, threadName);
setPolyphaseChannelIndices(channelIndexes); setPolyphaseChannelIndices(channelIndexes);
mMixerAssembler = new OneChannelMixerAssembler(gain); mMixerAssembler = new OneChannelMixerAssembler(gain);
mMixerAssembler.getMixer().setSampleRate(sampleRate); mMixerAssembler.getMixer().setSampleRate(sampleRate);

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer * Copyright (C) 2014-2024 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -37,15 +37,17 @@ public class TwoChannelOutputProcessor extends ChannelOutputProcessor
* *
* @param sampleRate of the output sample stream. * @param sampleRate of the output sample stream.
* @param channelIndexes containing two channel indices. * @param channelIndexes containing two channel indices.
* @param filter to use
* @param gain to apply to output. Typically this is equal to the channelizer's channel count. * @param gain to apply to output. Typically this is equal to the channelizer's channel count.
* @param heartbeatManager to be pinged on the dispatcher thread * @param heartbeatManager to be pinged on the dispatcher thread
* @param threadName for the dispatcher
*/ */
public TwoChannelOutputProcessor(double sampleRate, List<Integer> channelIndexes, float[] filter, float gain, public TwoChannelOutputProcessor(double sampleRate, List<Integer> channelIndexes, float[] filter, float gain,
HeartbeatManager heartbeatManager) HeartbeatManager heartbeatManager, String threadName)
{ {
//Set the frequency correction oscillator to 2 x output sample rate since we'll be correcting the frequency //Set the frequency correction oscillator to 2 x output sample rate since we'll be correcting the frequency
//after synthesizing both input channels //after synthesizing both input channels
super(2, sampleRate, heartbeatManager); super(2, heartbeatManager, threadName);
setPolyphaseChannelIndices(channelIndexes); setPolyphaseChannelIndices(channelIndexes);
mMixerAssembler = new TwoChannelMixerAssembler(gain); mMixerAssembler = new TwoChannelMixerAssembler(gain);
mMixerAssembler.getMixer().setSampleRate(sampleRate); mMixerAssembler.getMixer().setSampleRate(sampleRate);

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2022 Dennis Sheirer * Copyright (C) 2014-2024 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -35,6 +35,13 @@ import io.github.dsheirer.spectrum.ComplexDftProcessor;
import io.github.dsheirer.spectrum.DFTSize; import io.github.dsheirer.spectrum.DFTSize;
import io.github.dsheirer.spectrum.SpectrumPanel; import io.github.dsheirer.spectrum.SpectrumPanel;
import io.github.dsheirer.spectrum.converter.ComplexDecibelConverter; import io.github.dsheirer.spectrum.converter.ComplexDecibelConverter;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -47,13 +54,6 @@ import javax.swing.JToggleButton;
import javax.swing.SpinnerNumberModel; import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ChannelizerViewer extends JFrame public class ChannelizerViewer extends JFrame
{ {
@@ -262,7 +262,7 @@ public class ChannelizerViewer extends JFrame
for(int x = 0; x < mChannelCount; x++) for(int x = 0; x < mChannelCount; x++)
{ {
TunerChannel tunerChannel = new TunerChannel(100000000, 12500); TunerChannel tunerChannel = new TunerChannel(100000000, 12500);
TunerChannelSource source = mTestTuner.getChannelSourceManager().getSource(tunerChannel, null); TunerChannelSource source = mTestTuner.getChannelSourceManager().getSource(tunerChannel, null, "test");
DiscreteChannelPanel channelPanel = new DiscreteChannelPanel(mSettingsManager, source, x); DiscreteChannelPanel channelPanel = new DiscreteChannelPanel(mSettingsManager, source, x);
channelPanel.setDFTSize(mChannelPanelDFTSize); channelPanel.setDFTSize(mChannelPanelDFTSize);
@@ -362,7 +362,7 @@ public class ChannelizerViewer extends JFrame
mComplexDecibelConverter.addListener(mSpectrumPanel); mComplexDecibelConverter.addListener(mSpectrumPanel);
TunerChannel tunerChannel = new TunerChannel(frequency, bandwidth); TunerChannel tunerChannel = new TunerChannel(frequency, bandwidth);
mSource = mTestTuner.getChannelSourceManager().getSource(tunerChannel, null); mSource = mTestTuner.getChannelSourceManager().getSource(tunerChannel, null, "test");
if(mSource != null) if(mSource != null)
{ {
@@ -535,7 +535,7 @@ public class ChannelizerViewer extends JFrame
{ {
if(sourceCount < maxSourceCount) if(sourceCount < maxSourceCount)
{ {
TunerChannelSource source = tuner.getChannelSourceManager().getSource(tunerChannel, null); TunerChannelSource source = tuner.getChannelSourceManager().getSource(tunerChannel, null, "test");
if(source != null) if(source != null)
{ {

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer * Copyright (C) 2014-2024 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -379,7 +379,8 @@ public class ChannelizerViewer2 extends JFrame
mComplexDecibelConverter.addListener(mSpectrumPanel); mComplexDecibelConverter.addListener(mSpectrumPanel);
TunerChannel tunerChannel = new TunerChannel(frequency, bandwidth); TunerChannel tunerChannel = new TunerChannel(frequency, bandwidth);
mSource = mTestTuner.getChannelSourceManager().getSource(tunerChannel, new ChannelSpecification(50000, 12500, 6000, 7000)); mSource = mTestTuner.getChannelSourceManager().getSource(tunerChannel,
new ChannelSpecification(50000, 12500, 6000, 7000), "test");
if(mSource != null) if(mSource != null)
{ {

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2022 Dennis Sheirer * Copyright (C) 2014-2024 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -36,6 +36,13 @@ import io.github.dsheirer.spectrum.ComplexDftProcessor;
import io.github.dsheirer.spectrum.DFTSize; import io.github.dsheirer.spectrum.DFTSize;
import io.github.dsheirer.spectrum.SpectrumPanel; import io.github.dsheirer.spectrum.SpectrumPanel;
import io.github.dsheirer.spectrum.converter.ComplexDecibelConverter; import io.github.dsheirer.spectrum.converter.ComplexDecibelConverter;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -48,13 +55,6 @@ import javax.swing.JToggleButton;
import javax.swing.SpinnerNumberModel; import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class HeterodyneChannelizerViewer extends JFrame public class HeterodyneChannelizerViewer extends JFrame
{ {
@@ -261,7 +261,8 @@ public class HeterodyneChannelizerViewer extends JFrame
for(int x = 0; x < mChannelCount; x++) for(int x = 0; x < mChannelCount; x++)
{ {
TunerChannel tunerChannel = new TunerChannel(100000000, 12500); TunerChannel tunerChannel = new TunerChannel(100000000, 12500);
TunerChannelSource source = mTestTuner.getChannelSourceManager().getSource(tunerChannel, channelSpecification); TunerChannelSource source = mTestTuner.getChannelSourceManager().getSource(tunerChannel,
channelSpecification, "test");
DiscreteChannelPanel channelPanel = new DiscreteChannelPanel(mSettingsManager, source, x); DiscreteChannelPanel channelPanel = new DiscreteChannelPanel(mSettingsManager, source, x);
channelPanel.setDFTSize(mChannelPanelDFTSize); channelPanel.setDFTSize(mChannelPanelDFTSize);
@@ -362,7 +363,7 @@ public class HeterodyneChannelizerViewer extends JFrame
TunerChannel tunerChannel = new TunerChannel(frequency, bandwidth); TunerChannel tunerChannel = new TunerChannel(frequency, bandwidth);
ChannelSpecification channelSpecification = new ChannelSpecification(25000.0, 12500, 6000.0, 6250.0); ChannelSpecification channelSpecification = new ChannelSpecification(25000.0, 12500, 6000.0, 6250.0);
mSource = mTestTuner.getChannelSourceManager().getSource(tunerChannel, channelSpecification); mSource = mTestTuner.getChannelSourceManager().getSource(tunerChannel, channelSpecification, "test");
if(mSource != null) if(mSource != null)
{ {
@@ -533,7 +534,8 @@ public class HeterodyneChannelizerViewer extends JFrame
{ {
if(sourceCount < maxSourceCount) if(sourceCount < maxSourceCount)
{ {
TunerChannelSource source = tuner.getChannelSourceManager().getSource(tunerChannel, null); TunerChannelSource source = tuner.getChannelSourceManager().getSource(tunerChannel,
null, "test");
if(source != null) if(source != null)
{ {

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer * Copyright (C) 2014-2024 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * 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
* @param tunerChannel that details the desired channel frequency and bandwidth * @param tunerChannel that details the desired channel frequency and bandwidth
* @param sampleRate of the incoming sample stream * @param sampleRate of the incoming sample stream
* @param channelSpecification for the requested channel. * @param channelSpecification for the requested channel.
* @param threadName for the dispatcher
* @throws FilterDesignException if a final cleanup filter cannot be designed using the remez filter * @throws FilterDesignException if a final cleanup filter cannot be designed using the remez filter
* designer and the filter parameters. * designer and the filter parameters.
*/ */
public HalfBandTunerChannelSource(Listener<SourceEvent> producerSourceEventListener, TunerChannel tunerChannel, public HalfBandTunerChannelSource(Listener<SourceEvent> producerSourceEventListener, TunerChannel tunerChannel,
double sampleRate, ChannelSpecification channelSpecification) throws FilterDesignException double sampleRate, ChannelSpecification channelSpecification, String threadName)
throws FilterDesignException
{ {
super(producerSourceEventListener, tunerChannel); super(producerSourceEventListener, tunerChannel, threadName);
int desiredDecimation = (int)(sampleRate / channelSpecification.getMinimumSampleRate()); int desiredDecimation = (int)(sampleRate / channelSpecification.getMinimumSampleRate());
int decimation = DecimationFilterFactory.getDecimationRate(desiredDecimation); int decimation = DecimationFilterFactory.getDecimationRate(desiredDecimation);
@@ -74,7 +76,7 @@ public class HalfBandTunerChannelSource<T extends INativeBuffer> extends TunerCh
mQDecimationFilter = DecimationFilterFactory.getRealDecimationFilter(decimation); mQDecimationFilter = DecimationFilterFactory.getRealDecimationFilter(decimation);
//Set dispatcher to process 1/10 of estimated sample arrival rate, 20 times per second (up to 200% per interval) //Set dispatcher to process 1/10 of estimated sample arrival rate, 20 times per second (up to 200% per interval)
mBufferDispatcher = new Dispatcher("sdrtrunk heterodyne channel " + tunerChannel.getFrequency(), 50, getHeartbeatManager()); mBufferDispatcher = new Dispatcher(threadName, 50, getHeartbeatManager());
mBufferDispatcher.setListener(new NativeBufferProcessor()); mBufferDispatcher.setListener(new NativeBufferProcessor());
//Setup the frequency mixer to the current source frequency //Setup the frequency mixer to the current source frequency

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer * Copyright (C) 2014-2024 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -60,9 +60,9 @@ public class MultiFrequencyTunerChannelSource extends TunerChannelSource
public MultiFrequencyTunerChannelSource(TunerManager tunerManager, TunerChannelSource tunerChannelSource, public MultiFrequencyTunerChannelSource(TunerManager tunerManager, TunerChannelSource tunerChannelSource,
List<Long> frequencies, ChannelSpecification channelSpecification, List<Long> frequencies, ChannelSpecification channelSpecification,
String preferredTuner) String preferredTuner, String threadName)
{ {
super(null, tunerChannelSource.getTunerChannel()); super(null, tunerChannelSource.getTunerChannel(), threadName);
mTunerManager = tunerManager; mTunerManager = tunerManager;
mTunerChannelSource = tunerChannelSource; mTunerChannelSource = tunerChannelSource;
mTunerChannelSource.setSourceEventListener(mConsumerSourceEventAdapter); mTunerChannelSource.setSourceEventListener(mConsumerSourceEventAdapter);
@@ -114,7 +114,7 @@ public class MultiFrequencyTunerChannelSource extends TunerChannelSource
{ {
if(mStarted) if(mStarted)
{ {
Source source = mTunerManager.getSource(nextChannel, mChannelSpecification, mPreferredTuner); Source source = mTunerManager.getSource(nextChannel, mChannelSpecification, mPreferredTuner, mThreadName);
if(source instanceof TunerChannelSource) if(source instanceof TunerChannelSource)
{ {

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer * Copyright (C) 2014-2024 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -48,14 +48,14 @@ public class PassThroughChannelSource extends TunerChannelSource implements ISou
* @param listener to receive source events * @param listener to receive source events
* @param tunerController that provides current sample rate * @param tunerController that provides current sample rate
* @param tunerChannel requested for this channel * @param tunerChannel requested for this channel
* @param threadName for the dispatcher
*/ */
public PassThroughChannelSource(Listener<SourceEvent> listener, TunerController tunerController, public PassThroughChannelSource(Listener<SourceEvent> listener, TunerController tunerController,
TunerChannel tunerChannel) TunerChannel tunerChannel, String threadName)
{ {
super(listener, tunerChannel); super(listener, tunerChannel, threadName);
mTunerController = tunerController; mTunerController = tunerController;
mBufferDispatcher = new Dispatcher<>("sdrtrunk pass-through channel " + tunerChannel.getFrequency(), mBufferDispatcher = new Dispatcher<>(threadName, 50, getHeartbeatManager());
50, getHeartbeatManager());
mBufferDispatcher.setListener(new BufferProcessor()); mBufferDispatcher.setListener(new BufferProcessor());
} }

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer * Copyright (C) 2014-2024 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -36,6 +36,7 @@ public abstract class TunerChannelSource extends ComplexSource implements ISourc
protected TunerChannel mTunerChannel; protected TunerChannel mTunerChannel;
private Listener<SourceEvent> mProducerSourceEventListener; private Listener<SourceEvent> mProducerSourceEventListener;
private Listener<SourceEvent> mConsumerSourceEventListener; private Listener<SourceEvent> mConsumerSourceEventListener;
protected String mThreadName;
/** /**
* Tuner Channel Source is a Digital Drop Channel (DDC) abstract class that defines the minimum functionality * Tuner Channel Source is a Digital Drop Channel (DDC) abstract class that defines the minimum functionality
@@ -43,12 +44,15 @@ public abstract class TunerChannelSource extends ComplexSource implements ISourc
* *
* @param producerSourceEventListener to receive source event requests (e.g. start/stop sample stream) * @param producerSourceEventListener to receive source event requests (e.g. start/stop sample stream)
* @param tunerChannel describing the desired channel frequency and bandwidth/minimum sample rate * @param tunerChannel describing the desired channel frequency and bandwidth/minimum sample rate
* @param threadName for the channel's dispatcher
*/ */
public TunerChannelSource(Listener<SourceEvent> producerSourceEventListener, TunerChannel tunerChannel) public TunerChannelSource(Listener<SourceEvent> producerSourceEventListener, TunerChannel tunerChannel,
String threadName)
{ {
mProducerSourceEventListener = producerSourceEventListener; mProducerSourceEventListener = producerSourceEventListener;
mTunerChannel = tunerChannel; mTunerChannel = tunerChannel;
mConsumerSourceEventListenerAdapter = new SourceEventListenerToProcessorAdapter(this); mConsumerSourceEventListenerAdapter = new SourceEventListenerToProcessorAdapter(this);
mThreadName = threadName;
} }
@Override @Override

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer * Copyright (C) 2014-2024 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -77,9 +77,11 @@ public abstract class ChannelSourceManager implements ISourceEventProcessor
* *
* @param tunerChannel for requested source * @param tunerChannel for requested source
* @param channelSpecification for the requested channel * @param channelSpecification for the requested channel
* @param threadName for the source thread pool
* @return tuner channel source or null * @return tuner channel source or null
*/ */
public abstract TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification); public abstract TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification,
String threadName);
/** /**
* Signals that the complex buffer provider has an error and can no long provider buffers. The subclass should * Signals that the complex buffer provider has an error and can no long provider buffers. The subclass should

View File

@@ -104,7 +104,8 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
} }
@Override @Override
public TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification) public TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification,
String threadName)
{ {
if(!mRunning) if(!mRunning)
{ {
@@ -122,7 +123,7 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
{ {
//Attempt to create the channel source first, in case we get a filter design exception //Attempt to create the channel source first, in case we get a filter design exception
HalfBandTunerChannelSource tunerChannelSource = new HalfBandTunerChannelSource(mChannelSourceEventProcessor, HalfBandTunerChannelSource tunerChannelSource = new HalfBandTunerChannelSource(mChannelSourceEventProcessor,
tunerChannel, mTunerController.getSampleRate(), channelSpecification); tunerChannel, mTunerController.getSampleRate(), channelSpecification, threadName);
//Add to the list of channel sources so that it will receive the tuner frequency change //Add to the list of channel sources so that it will receive the tuner frequency change
mChannelSources.add(tunerChannelSource); mChannelSources.add(tunerChannelSource);
@@ -227,7 +228,6 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
*/ */
private void broadcastToChannels(SourceEvent sourceEvent) private void broadcastToChannels(SourceEvent sourceEvent)
{ {
// for(CICTunerChannelSource channelSource : mChannelSources)
for(HalfBandTunerChannelSource channelSource : mChannelSources) for(HalfBandTunerChannelSource channelSource : mChannelSources)
{ {
try try
@@ -248,7 +248,6 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
*/ */
private void updateTunerFrequency(long tunerFrequency) private void updateTunerFrequency(long tunerFrequency)
{ {
// for(CICTunerChannelSource channelSource : mChannelSources)
for(HalfBandTunerChannelSource channelSource : mChannelSources) for(HalfBandTunerChannelSource channelSource : mChannelSources)
{ {
channelSource.setFrequency(tunerFrequency); channelSource.setFrequency(tunerFrequency);

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer * Copyright (C) 2014-2024 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -93,7 +93,8 @@ public class PassThroughSourceManager extends ChannelSourceManager
} }
@Override @Override
public TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification) public TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification,
String threadName)
{ {
if(!mRunning) if(!mRunning)
@@ -107,7 +108,7 @@ public class PassThroughSourceManager extends ChannelSourceManager
{ {
mTunerController.getFrequencyControllerLock().lock(); mTunerController.getFrequencyControllerLock().lock();
PassThroughChannelSource channelSource = new PassThroughChannelSource(new SourceEventProxy(), PassThroughChannelSource channelSource = new PassThroughChannelSource(new SourceEventProxy(),
mTunerController, tunerChannel); mTunerController, tunerChannel, threadName);
mTunerChannels.add(tunerChannel); mTunerChannels.add(tunerChannel);
mTunerChannelSources.add(channelSource); mTunerChannelSources.add(channelSource);

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer * Copyright (C) 2014-2024 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -421,10 +421,12 @@ public class PolyphaseChannelSourceManager extends ChannelSourceManager
* *
* @param tunerChannel for requested source * @param tunerChannel for requested source
* @param channelSpecification for the requested channel * @param channelSpecification for the requested channel
* @param threadName for the dispatcher
* @return allocated DDC tuner channel source, or null if the channel cannot be provided by this source manager * @return allocated DDC tuner channel source, or null if the channel cannot be provided by this source manager
*/ */
@Override @Override
public TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification) public TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification,
String threadName)
{ {
TunerChannelSource tunerChannelSource = null; TunerChannelSource tunerChannelSource = null;
@@ -455,7 +457,7 @@ public class PolyphaseChannelSourceManager extends ChannelSourceManager
} }
//If we're successful to here, allocate the channel //If we're successful to here, allocate the channel
tunerChannelSource = mPolyphaseChannelManager.getChannel(tunerChannel); tunerChannelSource = mPolyphaseChannelManager.getChannel(tunerChannel, threadName);
} }
catch(SourceException se) catch(SourceException se)
{ {

View File

@@ -515,7 +515,16 @@ public class TunerManager implements IDiscoveredTunerStatusListener
return mDiscoveredTunerModel.getAvailableTuners(); return mDiscoveredTunerModel.getAvailableTuners();
} }
public Source getSource(SourceConfiguration config, ChannelSpecification channelSpecification) throws SourceException /**
* Obtain a channel (sample stream) source from one of the tuners.
* @param config for the source
* @param channelSpecification required by the decoder
* @param thread name to apply for the channel's scheduled executor
* @return a configured source or null if there aren't any tuners that can provide the source.
* @throws SourceException if there is an issue.
*/
public Source getSource(SourceConfiguration config, ChannelSpecification channelSpecification,
String threadName) throws SourceException
{ {
Source retVal = null; Source retVal = null;
@@ -530,7 +539,8 @@ public class TunerManager implements IDiscoveredTunerStatusListener
SourceConfigTuner sourceConfigTuner = (SourceConfigTuner)config; SourceConfigTuner sourceConfigTuner = (SourceConfigTuner)config;
TunerChannel tunerChannel = sourceConfigTuner.getTunerChannel(channelSpecification.getBandwidth()); TunerChannel tunerChannel = sourceConfigTuner.getTunerChannel(channelSpecification.getBandwidth());
String preferredTuner = sourceConfigTuner.getPreferredTuner(); String preferredTuner = sourceConfigTuner.getPreferredTuner();
retVal = getSource(tunerChannel, channelSpecification, preferredTuner); retVal = getSource(tunerChannel, channelSpecification, preferredTuner, threadName +
" " + tunerChannel.getFrequency());
} }
break; break;
case TUNER_MULTIPLE_FREQUENCIES: case TUNER_MULTIPLE_FREQUENCIES:
@@ -540,12 +550,13 @@ public class TunerManager implements IDiscoveredTunerStatusListener
TunerChannel tunerChannel = sourceConfigTuner.getTunerChannel(channelSpecification.getBandwidth()); TunerChannel tunerChannel = sourceConfigTuner.getTunerChannel(channelSpecification.getBandwidth());
String preferredTuner = sourceConfigTuner.getPreferredTuner(); String preferredTuner = sourceConfigTuner.getPreferredTuner();
Source source = getSource(tunerChannel, channelSpecification, preferredTuner); Source source = getSource(tunerChannel, channelSpecification, preferredTuner, threadName);
if(source instanceof TunerChannelSource) if(source instanceof TunerChannelSource)
{ {
retVal = new MultiFrequencyTunerChannelSource(this, (TunerChannelSource)source, retVal = new MultiFrequencyTunerChannelSource(this, (TunerChannelSource)source,
sourceConfigTuner.getFrequencies(), channelSpecification, sourceConfigTuner.getPreferredTuner()); sourceConfigTuner.getFrequencies(), channelSpecification,
sourceConfigTuner.getPreferredTuner(), threadName + " MULTI FREQ");
} }
} }
break; break;
@@ -558,10 +569,15 @@ public class TunerManager implements IDiscoveredTunerStatusListener
/** /**
* Iterates current available tuners to get a tuner channel source for the specified frequency and bandwidth * Iterates current available tuners to get a tuner channel source for the specified frequency and bandwidth
* @param tunerChannel requested
* @param channelSpecification from the decoder
* @param preferredTuner name
* @param threadName to assign to the channel's thread pool
* *
* Returns null if no tuner can source the channel * Returns null if no tuner can source the channel
*/ */
public Source getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification, String preferredTuner) public Source getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification, String preferredTuner,
String threadName)
{ {
TunerChannelSource source = null; TunerChannelSource source = null;
@@ -577,7 +593,8 @@ public class TunerManager implements IDiscoveredTunerStatusListener
{ {
try try
{ {
source = discoveredTuner.getTuner().getChannelSourceManager().getSource(tunerChannel, channelSpecification); source = discoveredTuner.getTuner().getChannelSourceManager().getSource(tunerChannel,
channelSpecification, threadName);
if(source != null) if(source != null)
{ {
@@ -604,7 +621,8 @@ public class TunerManager implements IDiscoveredTunerStatusListener
{ {
try try
{ {
source = discoveredTuner.getTuner().getChannelSourceManager().getSource(tunerChannel, channelSpecification); source = discoveredTuner.getTuner().getChannelSourceManager().getSource(tunerChannel,
channelSpecification, threadName);
} }
catch(Exception e) catch(Exception e)
{ {

View File

@@ -44,7 +44,7 @@ public class Dispatcher<E> implements Listener<E>
private final LinkedTransferQueue<E> mQueue = new LinkedTransferQueue<>(); private final LinkedTransferQueue<E> mQueue = new LinkedTransferQueue<>();
private Listener<E> mListener; private Listener<E> mListener;
private final AtomicBoolean mRunning = new AtomicBoolean(); private final AtomicBoolean mRunning = new AtomicBoolean();
private final String mThreadName; private String mThreadName;
private ScheduledExecutorService mExecutorService; private ScheduledExecutorService mExecutorService;
private ScheduledFuture<?> mScheduledFuture; private ScheduledFuture<?> mScheduledFuture;
private final long mInterval; private final long mInterval;
@@ -73,6 +73,15 @@ public class Dispatcher<E> implements Listener<E>
mInterval = interval; mInterval = interval;
} }
/**
* Sets the thread name. If this dispatcher is already started, this has no effect.
* @param threadName to use for this dispatcher.
*/
public void setThreadName(String threadName)
{
mThreadName = threadName;
}
/** /**
* Sets or changes the listener to receive buffers from this processor. * Sets or changes the listener to receive buffers from this processor.
* @param listener to receive buffers * @param listener to receive buffers