#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

@@ -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
* 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 sampleRate of the incoming sample stream
* @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
* designer and the filter parameters.
*/
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 decimation = DecimationFilterFactory.getDecimationRate(desiredDecimation);
@@ -74,7 +76,7 @@ public class HalfBandTunerChannelSource<T extends INativeBuffer> extends TunerCh
mQDecimationFilter = DecimationFilterFactory.getRealDecimationFilter(decimation);
//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());
//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
* 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,
List<Long> frequencies, ChannelSpecification channelSpecification,
String preferredTuner)
String preferredTuner, String threadName)
{
super(null, tunerChannelSource.getTunerChannel());
super(null, tunerChannelSource.getTunerChannel(), threadName);
mTunerManager = tunerManager;
mTunerChannelSource = tunerChannelSource;
mTunerChannelSource.setSourceEventListener(mConsumerSourceEventAdapter);
@@ -114,7 +114,7 @@ public class MultiFrequencyTunerChannelSource extends TunerChannelSource
{
if(mStarted)
{
Source source = mTunerManager.getSource(nextChannel, mChannelSpecification, mPreferredTuner);
Source source = mTunerManager.getSource(nextChannel, mChannelSpecification, mPreferredTuner, mThreadName);
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
* 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 tunerController that provides current sample rate
* @param tunerChannel requested for this channel
* @param threadName for the dispatcher
*/
public PassThroughChannelSource(Listener<SourceEvent> listener, TunerController tunerController,
TunerChannel tunerChannel)
TunerChannel tunerChannel, String threadName)
{
super(listener, tunerChannel);
super(listener, tunerChannel, threadName);
mTunerController = tunerController;
mBufferDispatcher = new Dispatcher<>("sdrtrunk pass-through channel " + tunerChannel.getFrequency(),
50, getHeartbeatManager());
mBufferDispatcher = new Dispatcher<>(threadName, 50, getHeartbeatManager());
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
* 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;
private Listener<SourceEvent> mProducerSourceEventListener;
private Listener<SourceEvent> mConsumerSourceEventListener;
protected String mThreadName;
/**
* 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 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;
mTunerChannel = tunerChannel;
mConsumerSourceEventListenerAdapter = new SourceEventListenerToProcessorAdapter(this);
mThreadName = threadName;
}
@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
* 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 channelSpecification for the requested channel
* @param threadName for the source thread pool
* @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

View File

@@ -104,7 +104,8 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
}
@Override
public TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification)
public TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification,
String threadName)
{
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
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
mChannelSources.add(tunerChannelSource);
@@ -227,7 +228,6 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
*/
private void broadcastToChannels(SourceEvent sourceEvent)
{
// for(CICTunerChannelSource channelSource : mChannelSources)
for(HalfBandTunerChannelSource channelSource : mChannelSources)
{
try
@@ -248,7 +248,6 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
*/
private void updateTunerFrequency(long tunerFrequency)
{
// for(CICTunerChannelSource channelSource : mChannelSources)
for(HalfBandTunerChannelSource channelSource : mChannelSources)
{
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
* it under the terms of the GNU General Public License as published by
@@ -93,7 +93,8 @@ public class PassThroughSourceManager extends ChannelSourceManager
}
@Override
public TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification)
public TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification,
String threadName)
{
if(!mRunning)
@@ -107,7 +108,7 @@ public class PassThroughSourceManager extends ChannelSourceManager
{
mTunerController.getFrequencyControllerLock().lock();
PassThroughChannelSource channelSource = new PassThroughChannelSource(new SourceEventProxy(),
mTunerController, tunerChannel);
mTunerController, tunerChannel, threadName);
mTunerChannels.add(tunerChannel);
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
* 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 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
*/
@Override
public TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification)
public TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification,
String threadName)
{
TunerChannelSource tunerChannelSource = null;
@@ -455,7 +457,7 @@ public class PolyphaseChannelSourceManager extends ChannelSourceManager
}
//If we're successful to here, allocate the channel
tunerChannelSource = mPolyphaseChannelManager.getChannel(tunerChannel);
tunerChannelSource = mPolyphaseChannelManager.getChannel(tunerChannel, threadName);
}
catch(SourceException se)
{

View File

@@ -515,7 +515,16 @@ public class TunerManager implements IDiscoveredTunerStatusListener
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;
@@ -530,7 +539,8 @@ public class TunerManager implements IDiscoveredTunerStatusListener
SourceConfigTuner sourceConfigTuner = (SourceConfigTuner)config;
TunerChannel tunerChannel = sourceConfigTuner.getTunerChannel(channelSpecification.getBandwidth());
String preferredTuner = sourceConfigTuner.getPreferredTuner();
retVal = getSource(tunerChannel, channelSpecification, preferredTuner);
retVal = getSource(tunerChannel, channelSpecification, preferredTuner, threadName +
" " + tunerChannel.getFrequency());
}
break;
case TUNER_MULTIPLE_FREQUENCIES:
@@ -540,12 +550,13 @@ public class TunerManager implements IDiscoveredTunerStatusListener
TunerChannel tunerChannel = sourceConfigTuner.getTunerChannel(channelSpecification.getBandwidth());
String preferredTuner = sourceConfigTuner.getPreferredTuner();
Source source = getSource(tunerChannel, channelSpecification, preferredTuner);
Source source = getSource(tunerChannel, channelSpecification, preferredTuner, threadName);
if(source instanceof TunerChannelSource)
{
retVal = new MultiFrequencyTunerChannelSource(this, (TunerChannelSource)source,
sourceConfigTuner.getFrequencies(), channelSpecification, sourceConfigTuner.getPreferredTuner());
sourceConfigTuner.getFrequencies(), channelSpecification,
sourceConfigTuner.getPreferredTuner(), threadName + " MULTI FREQ");
}
}
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
* @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
*/
public Source getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification, String preferredTuner)
public Source getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification, String preferredTuner,
String threadName)
{
TunerChannelSource source = null;
@@ -577,7 +593,8 @@ public class TunerManager implements IDiscoveredTunerStatusListener
{
try
{
source = discoveredTuner.getTuner().getChannelSourceManager().getSource(tunerChannel, channelSpecification);
source = discoveredTuner.getTuner().getChannelSourceManager().getSource(tunerChannel,
channelSpecification, threadName);
if(source != null)
{
@@ -604,7 +621,8 @@ public class TunerManager implements IDiscoveredTunerStatusListener
{
try
{
source = discoveredTuner.getTuner().getChannelSourceManager().getSource(tunerChannel, channelSpecification);
source = discoveredTuner.getTuner().getChannelSourceManager().getSource(tunerChannel,
channelSpecification, threadName);
}
catch(Exception e)
{