mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-16 18:47:33 -05:00
#2055 Multi-Frequency channel source with channel rotation monitor startup can get ahead of the tuner channel source and cause an NPE. (#2056)
Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
@@ -153,13 +153,19 @@ public class MultiFrequencyTunerChannelSource extends TunerChannelSource
|
|||||||
@Override
|
@Override
|
||||||
public void stop()
|
public void stop()
|
||||||
{
|
{
|
||||||
mStarted = false;
|
//Don't perform stop sequence if we haven't been started. There can be a small window on startup where the
|
||||||
|
//channel rotation monitor can get ahead of the channel source and cause it to try to stop and rotate before
|
||||||
if(mTunerChannelSource != null)
|
//it has even started, causing an error in the polyphase channel source.
|
||||||
|
if(mStarted)
|
||||||
{
|
{
|
||||||
mTunerChannelSource.stop();
|
mStarted = false;
|
||||||
mTunerChannelSource.removeSourceEventListener();
|
|
||||||
mTunerChannelSource = null;
|
if(mTunerChannelSource != null)
|
||||||
|
{
|
||||||
|
mTunerChannelSource.stop();
|
||||||
|
mTunerChannelSource.removeSourceEventListener();
|
||||||
|
mTunerChannelSource = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,9 +68,13 @@ public class ChannelRotationMonitor extends Module implements ISourceEventProvid
|
|||||||
mRotationDelay = rotationDelay;
|
mRotationDelay = rotationDelay;
|
||||||
mUserPreferences = userPreferences;
|
mUserPreferences = userPreferences;
|
||||||
|
|
||||||
if(mRotationDelay == 0)
|
if(mRotationDelay < CHANNEL_ROTATION_DELAY_MINIMUM)
|
||||||
{
|
{
|
||||||
mRotationDelay = 200;
|
mRotationDelay = CHANNEL_ROTATION_DELAY_MINIMUM;
|
||||||
|
}
|
||||||
|
else if(mRotationDelay > CHANNEL_ROTATION_DELAY_MAXIMUM)
|
||||||
|
{
|
||||||
|
mRotationDelay = CHANNEL_ROTATION_DELAY_MAXIMUM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +188,7 @@ public class ChannelRotationMonitor extends Module implements ISourceEventProvid
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mScheduledFuture = ThreadPool.SCHEDULED.scheduleAtFixedRate(runnable, mRotationDelay,
|
mScheduledFuture = ThreadPool.SCHEDULED.scheduleAtFixedRate(runnable, mRotationDelay * 2,
|
||||||
mRotationDelay / 2, TimeUnit.MILLISECONDS);
|
mRotationDelay / 2, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user