#1845 Updates polyphase tuner channel manager to avoid retuning for a new channel if all channels will continue to fit using the current center frequency (#1846)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2024-02-11 05:22:18 -05:00
committed by GitHub
parent 7ea8cb63d2
commit 6532e33296
2 changed files with 4 additions and 44 deletions

View File

@@ -647,45 +647,6 @@ public abstract class TunerController implements Tunable, ISourceEventProcessor,
broadcast(nativeBuffer);
}
/**
* Indicates if the current center frequency and bandwidth is correct to source the tuner channel
*
* @param tunerChannel to test
* @return true if the current center frequency and bandwidth is correct for the channel
*/
public boolean isTunedFor(TunerChannel tunerChannel)
{
try
{
if(tunerChannel.getMinFrequency() < getMinTunedFrequency())
{
return false;
}
if(tunerChannel.getMaxFrequency() > getMaxTunedFrequency())
{
return false;
}
if(hasMiddleUnusableBandwidth())
{
long minAvoid = getFrequency() - getMiddleUnusableHalfBandwidth();
long maxAvoid = getFrequency() + getMiddleUnusableHalfBandwidth();
if(tunerChannel.overlaps(minAvoid, maxAvoid))
{
return false;
}
}
}
catch(SourceException se)
{
return false;
}
return true;
}
/**
* Indicates if the current center frequency and bandwidth is correct to source the tuner channel set
*

View File

@@ -195,15 +195,14 @@ public class PolyphaseChannelSourceManager extends ChannelSourceManager
throw new IllegalArgumentException("Channel set bandwidth is greater than tuner's available bandwidth");
}
long bestIntegralFrequency = getIntegralFrequency(channels);
//Strategy 1: reuse the current frequency if it's a good integral and the channels fit
if(isIntegralSpacing(currentCenterFrequency, bestIntegralFrequency) &&
isValidCenterFrequency(channels, currentCenterFrequency))
//Strategy 1: reuse the current frequency if the channels fit
if(isValidCenterFrequency(channels, currentCenterFrequency))
{
return currentCenterFrequency;
}
long bestIntegralFrequency = getIntegralFrequency(channels);
double usableHalfBandwidth = mTunerController.getUsableHalfBandwidth();
//Strategy 2: start by placing the center frequency exactly one channel width below the first channel frequency