#1506 Resolves multiple performance issues: tuner freezing after a period of run time, buffer overflows, degraded audio playback. (#1513)

-Reduces message and event histories per channel from 500 to 200.
-Resolves issue of tuner freezing due to cancelled USB transfer buffers not being resubmitted.
-Reworks the audio playback system to remove in-progress call preemption and remove thread locks which can cause glitchy behavior during audio playback.
-Updates audio outputs to also use single thread pool for processing audio segments.
-Updates MBECallSequenceConverter to batch convert MBE to WAV audio.
-Unifies recording filename prefixes across baseband, mbe and binary recordings.
-Resolves issue with registering heartbeat manager to dispatcher.
-Uses single-thread thread pools for Dispatcher to support batch & process to overcome context switching consistency issue in Windows.

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2023-04-11 04:07:41 -04:00
committed by GitHub
parent 32a8363b45
commit 372d2ff870
34 changed files with 802 additions and 1112 deletions

View File

@@ -1,7 +1,6 @@
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 Dennis Sheirer
* *****************************************************************************
* Copyright (C) 2014-2023 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
@@ -15,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* *****************************************************************************
* ****************************************************************************
*/
package io.github.dsheirer.preference;
@@ -30,15 +29,14 @@ public enum TimestampFormat
TIMESTAMP_DEFAULT("yyyy-MM-dd HH:mm:ss", "Timestamp: yyyy-MM-dd HH:mm:ss"),
TIMESTAMP_COLONS("yyyy:MM:dd:HH:mm:ss", "Timestamp Colons: yyyy:MM:dd:HH:mm:ss"),
TIMESTAMP_MILLIS("yyyy:MM:dd:HH:mm:ss.SSS", "Timestamp Milliseconds: yyyy:MM:dd:HH:mm:ss.SSS"),
TIMESTAMP_COMPACT("yyyyMMddHHmmss", "Timestamp Compact: yyyyMMddHHmmss"),
TIMESTAMP_COMPACT("yyyyMMdd_HHmmss", "Timestamp Compact: yyyyMMdd_HHmmss"),
DATE_DASHES("yyyy-MM-dd", "Date Dashes: YYYY-MM-DD"),
DATE_COLONS("yyyy:MM:dd", "Date Colons: YYYY:MM:DD"),
DATE_COMPACT("yyyyMMdd", "Date Compact: YYYYMMDD"),
TIME_COMPACT("HHmmss", "Time Compact: HHmmss"),
TIME_COLONS("HH:mm:ss", "Time Colons: HH:mm:ss"),
TIME_MILLIS("HH:mm:ss.SSS", "Time Milliseconds: HH:mm:ss.SSS"),
TIME_SECONDS("ss.SSS", "Time Seconds: ss.SSS"),
;
TIME_SECONDS("ss.SSS", "Time Seconds: ss.SSS");
private String mFormat;
private String mLabel;

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2020 Dennis Sheirer
* Copyright (C) 2014-2023 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
@@ -25,14 +25,12 @@ import io.github.dsheirer.gui.preference.playback.ToneVolume;
import io.github.dsheirer.preference.Preference;
import io.github.dsheirer.preference.PreferenceType;
import io.github.dsheirer.sample.Listener;
import io.github.dsheirer.source.mixer.MixerChannel;
import io.github.dsheirer.source.mixer.MixerChannelConfiguration;
import io.github.dsheirer.source.mixer.MixerManager;
import java.util.prefs.Preferences;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.prefs.Preferences;
/**
* User preferences for audio playback
*/
@@ -42,10 +40,6 @@ public class PlaybackPreference extends Preference
private static final String PREFERENCE_KEY_DROP_TONE_FREQUENCY = "audio.playback.segment.drop.frequency";
private static final String PREFERENCE_KEY_DROP_TONE_VOLUME = "audio.playback.segment.drop.volume";
private static final String PREFERENCE_KEY_USE_AUDIO_SEGMENT_PREEMPT_TONE = "audio.playback.segment.preempt.tone";
private static final String PREFERENCE_KEY_PREEMPT_TONE_FREQUENCY = "audio.playback.segment.preempt.frequency";
private static final String PREFERENCE_KEY_PREEMPT_TONE_VOLUME = "audio.playback.segment.preempt.volume";
private static final String PREFERENCE_KEY_USE_AUDIO_SEGMENT_START_TONE = "audio.playback.segment.start.tone";
private static final String PREFERENCE_KEY_START_TONE_FREQUENCY = "audio.playback.segment.start.frequency";
private static final String PREFERENCE_KEY_START_TONE_VOLUME = "audio.playback.segment.start.volume";
@@ -56,12 +50,9 @@ public class PlaybackPreference extends Preference
private final static Logger mLog = LoggerFactory.getLogger(PlaybackPreference.class);
private Preferences mPreferences = Preferences.userNodeForPackage(PlaybackPreference.class);
private Boolean mUseAudioSegmentStartTone;
private Boolean mUseAudioSegmentPreemptTone;
private Boolean mUseAudioSegmentDropTone;
private ToneFrequency mStartToneFrequency;
private ToneVolume mStartToneVolume;
private ToneFrequency mPreemptToneFrequency;
private ToneVolume mPreemptToneVolume;
private ToneFrequency mDropToneFrequency;
private ToneVolume mDropToneVolume;
private MixerChannelConfiguration mMixerChannelConfiguration;
@@ -127,29 +118,6 @@ public class PlaybackPreference extends Preference
notifyPreferenceUpdated();
}
/**
* Indicates if an audio segment preempt tone should be used.
*/
public boolean getUseAudioSegmentPreemptTone()
{
if(mUseAudioSegmentPreemptTone == null)
{
mUseAudioSegmentPreemptTone = mPreferences.getBoolean(PREFERENCE_KEY_USE_AUDIO_SEGMENT_PREEMPT_TONE, true);
}
return mUseAudioSegmentPreemptTone;
}
/**
* Sets the preference for using an audio segment preempt tone
*/
public void setUseAudioSegmentPreemptTone(boolean use)
{
mUseAudioSegmentPreemptTone = use;
mPreferences.putBoolean(PREFERENCE_KEY_USE_AUDIO_SEGMENT_PREEMPT_TONE, use);
notifyPreferenceUpdated();
}
/**
* Frequency for the drop tone
*/
@@ -198,30 +166,6 @@ public class PlaybackPreference extends Preference
notifyPreferenceUpdated();
}
/**
* Frequency for the preempt tone
*/
public ToneFrequency getPreemptToneFrequency()
{
if(mPreemptToneFrequency == null)
{
int frequency = mPreferences.getInt(PREFERENCE_KEY_PREEMPT_TONE_FREQUENCY, ToneFrequency.F400.getValue());
mPreemptToneFrequency = ToneFrequency.fromValue(frequency);
}
return mPreemptToneFrequency;
}
/**
* Sets the frequency for the preempt tone
*/
public void setPreemptToneFrequency(ToneFrequency toneFrequency)
{
mPreemptToneFrequency = toneFrequency;
mPreferences.putInt(PREFERENCE_KEY_PREEMPT_TONE_FREQUENCY, toneFrequency.getValue());
notifyPreferenceUpdated();
}
/**
* Drop tone volume
*/
@@ -270,30 +214,6 @@ public class PlaybackPreference extends Preference
notifyPreferenceUpdated();
}
/**
* Preempt tone volume
*/
public ToneVolume getPreemptToneVolume()
{
if(mPreemptToneVolume == null)
{
int volume = mPreferences.getInt(PREFERENCE_KEY_PREEMPT_TONE_VOLUME, ToneVolume.V5.getValue());
mPreemptToneVolume = ToneVolume.fromValue(volume);
}
return mPreemptToneVolume;
}
/**
* Sets the preempt tone volume
*/
public void setPreemptToneVolume(ToneVolume toneVolume)
{
mPreemptToneVolume = toneVolume;
mPreferences.putInt(PREFERENCE_KEY_PREEMPT_TONE_VOLUME, toneVolume.getValue());
notifyPreferenceUpdated();
}
/**
* Buffer with samples for the audio segment start tone
*/
@@ -307,19 +227,6 @@ public class PlaybackPreference extends Preference
return null;
}
/**
* Buffer with samples for the audio segment preempt tone
*/
public float[] getPreemptTone()
{
if(getUseAudioSegmentPreemptTone())
{
return ToneUtil.getTone(getPreemptToneFrequency(), getPreemptToneVolume(), TONE_LENGTH_SAMPLES);
}
return null;
}
/**
* Buffer with samples for the audio segment drop tone
*/