Reverting waits
Waits are still overlapping. Will discuss with Robin for advice on how he wants to manage them. My attempt stopped the over lap but broke the loading.
This commit is contained in:
+3
-3
@@ -2086,8 +2086,8 @@ public:
|
|||||||
virtual void UpdateServerConfiguration(const JackServerSettings &jackServerSettings,
|
virtual void UpdateServerConfiguration(const JackServerSettings &jackServerSettings,
|
||||||
std::function<void(bool success, const std::string &errorMessage)> onComplete)
|
std::function<void(bool success, const std::string &errorMessage)> onComplete)
|
||||||
{
|
{
|
||||||
// Only allow one restart operation at a time.
|
|
||||||
CleanRestartThreads(true);
|
|
||||||
std::lock_guard guard(restart_mutex);
|
std::lock_guard guard(restart_mutex);
|
||||||
RestartThread *pShutdown = new RestartThread(this, jackServerSettings, onComplete);
|
RestartThread *pShutdown = new RestartThread(this, jackServerSettings, onComplete);
|
||||||
restartThreads.push_back(pShutdown);
|
restartThreads.push_back(pShutdown);
|
||||||
@@ -2364,4 +2364,4 @@ JSON_MAP_REFERENCE(JackHostStatus, cpuFreqMin)
|
|||||||
JSON_MAP_REFERENCE(JackHostStatus, cpuFreqMax)
|
JSON_MAP_REFERENCE(JackHostStatus, cpuFreqMax)
|
||||||
JSON_MAP_REFERENCE(JackHostStatus, hasCpuGovernor)
|
JSON_MAP_REFERENCE(JackHostStatus, hasCpuGovernor)
|
||||||
JSON_MAP_REFERENCE(JackHostStatus, governor)
|
JSON_MAP_REFERENCE(JackHostStatus, governor)
|
||||||
JSON_MAP_END()
|
JSON_MAP_END()
|
||||||
+5
-55
@@ -1377,31 +1377,6 @@ void PiPedalModel::RestartAudio(bool useDummyAudioDriver)
|
|||||||
jackServerSettings.UseDummyAudioDevice();
|
jackServerSettings.UseDummyAudioDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
auto jackConfiguration = this->jackConfiguration;
|
auto jackConfiguration = this->jackConfiguration;
|
||||||
jackConfiguration.AlsaInitialize(jackServerSettings);
|
jackConfiguration.AlsaInitialize(jackServerSettings);
|
||||||
if (!jackConfiguration.isValid())
|
if (!jackConfiguration.isValid())
|
||||||
@@ -2772,31 +2747,6 @@ static bool HasAlsaDevice(const std::vector<AlsaDeviceInfo> devices, const std::
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PiPedalModel::StartHotspotMonitoring()
|
void PiPedalModel::StartHotspotMonitoring()
|
||||||
{
|
{
|
||||||
this->avahiService = std::make_unique<AvahiService>();
|
this->avahiService = std::make_unique<AvahiService>();
|
||||||
@@ -3065,25 +3015,25 @@ void PiPedalModel::OnAlsaDriverTerminatedAbnormally()
|
|||||||
auto now = clock::now();
|
auto now = clock::now();
|
||||||
clock::duration timeSinceLastRetry = now-this->lastRestartTime;
|
clock::duration timeSinceLastRetry = now-this->lastRestartTime;
|
||||||
this->lastRestartTime = now;
|
this->lastRestartTime = now;
|
||||||
if (timeSinceLastRetry > std::chrono::duration_cast<clock::duration>(std::chrono::seconds(6))) {
|
if (timeSinceLastRetry > std::chrono::duration_cast<clock::duration>(std::chrono::milliseconds(1000))) {
|
||||||
audioRestartRetries = 0;
|
audioRestartRetries = 0;
|
||||||
}
|
}
|
||||||
CancelAudioRetry();
|
CancelAudioRetry();
|
||||||
|
|
||||||
if (audioRestartRetries == 0)
|
if (audioRestartRetries == 0)
|
||||||
{
|
{
|
||||||
this->audioRetryPostHandle = this->PostDelayed(
|
this->audioRetryPostHandle = this->Post(
|
||||||
std::chrono::seconds(5),
|
|
||||||
// No lock to avoid deadlocks!
|
// No lock to avoid deadlocks!
|
||||||
[this]() {
|
[this]() {
|
||||||
Lv2Log::info("Restarting audio.");
|
Lv2Log::info("Restarting audio.");
|
||||||
this->RestartAudio();
|
this->RestartAudio();
|
||||||
});
|
});
|
||||||
++audioRestartRetries;
|
++audioRestartRetries;
|
||||||
} else if (audioRestartRetries < 3)
|
} else if (audioRestartRetries < 3)
|
||||||
{
|
{
|
||||||
this->audioRetryPostHandle = this->PostDelayed(
|
this->audioRetryPostHandle = this->PostDelayed(
|
||||||
std::chrono::seconds(5),
|
std::chrono::milliseconds(100 * audioRestartRetries),
|
||||||
[this]() {
|
[this]() {
|
||||||
if (closed) {
|
if (closed) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ function getBestBuffers(
|
|||||||
if (validBufferSizes.indexOf(32) !== -1) {
|
if (validBufferSizes.indexOf(32) !== -1) {
|
||||||
validBufferSizes = [32, ...validBufferSizes.filter(v => v !== 32)];
|
validBufferSizes = [32, ...validBufferSizes.filter(v => v !== 32)];
|
||||||
}
|
}
|
||||||
|
|
||||||
function tryPick(count: number): BufferSetting | undefined {
|
function tryPick(count: number): BufferSetting | undefined {
|
||||||
for (let bs of validBufferSizes) {
|
for (let bs of validBufferSizes) {
|
||||||
const counts = getValidBufferCountsMultiple(bs, inDevice, outDevice);
|
const counts = getValidBufferCountsMultiple(bs, inDevice, outDevice);
|
||||||
@@ -275,14 +275,14 @@ function isOkEnabled(jackServerSettings: JackServerSettings, alsaDevices?: AlsaD
|
|||||||
{
|
{
|
||||||
if (!alsaDevices) return false;
|
if (!alsaDevices) return false;
|
||||||
if (!jackServerSettings.alsaInputDevice || !jackServerSettings.alsaOutputDevice) return false;
|
if (!jackServerSettings.alsaInputDevice || !jackServerSettings.alsaOutputDevice) return false;
|
||||||
|
|
||||||
const inDevice = alsaDevices.find(d => d.id === jackServerSettings.alsaInputDevice && d.supportsCapture);
|
const inDevice = alsaDevices.find(d => d.id === jackServerSettings.alsaInputDevice && d.supportsCapture);
|
||||||
const outDevice = alsaDevices.find(d => d.id === jackServerSettings.alsaOutputDevice && d.supportsPlayback);
|
const outDevice = alsaDevices.find(d => d.id === jackServerSettings.alsaOutputDevice && d.supportsPlayback);
|
||||||
if (!inDevice || !outDevice) return false;
|
if (!inDevice || !outDevice) return false;
|
||||||
|
|
||||||
const sampleRates = intersectArrays(inDevice.sampleRates, outDevice.sampleRates);
|
const sampleRates = intersectArrays(inDevice.sampleRates, outDevice.sampleRates);
|
||||||
if (sampleRates.indexOf(jackServerSettings.sampleRate) === -1) return false;
|
if (sampleRates.indexOf(jackServerSettings.sampleRate) === -1) return false;
|
||||||
|
|
||||||
const deviceBufferSize = jackServerSettings.bufferSize * jackServerSettings.numberOfBuffers;
|
const deviceBufferSize = jackServerSettings.bufferSize * jackServerSettings.numberOfBuffers;
|
||||||
const minSize = Math.max(inDevice.minBufferSize, outDevice.minBufferSize);
|
const minSize = Math.max(inDevice.minBufferSize, outDevice.minBufferSize);
|
||||||
const maxSize = Math.min(inDevice.maxBufferSize, outDevice.maxBufferSize);
|
const maxSize = Math.min(inDevice.maxBufferSize, outDevice.maxBufferSize);
|
||||||
@@ -323,7 +323,7 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
|
|
||||||
suppressDeviceWarning: boolean;
|
suppressDeviceWarning: boolean;
|
||||||
originalJackServerSettings?: JackServerSettings;
|
originalJackServerSettings?: JackServerSettings;
|
||||||
|
|
||||||
getFullScreen() {
|
getFullScreen() {
|
||||||
return document.documentElement.clientWidth < 420 ||
|
return document.documentElement.clientWidth < 420 ||
|
||||||
document.documentElement.clientHeight < 700;
|
document.documentElement.clientHeight < 700;
|
||||||
@@ -417,7 +417,7 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
if (!outDevice) result.alsaOutputDevice = INVALID_DEVICE_ID;
|
if (!outDevice) result.alsaOutputDevice = INVALID_DEVICE_ID;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
let sampleRates = intersectArrays(inDevice.sampleRates, outDevice.sampleRates);
|
let sampleRates = intersectArrays(inDevice.sampleRates, outDevice.sampleRates);
|
||||||
if (sampleRates.length !== 0 && sampleRates.indexOf(result.sampleRate) === -1) {
|
if (sampleRates.length !== 0 && sampleRates.indexOf(result.sampleRate) === -1) {
|
||||||
let bestSr = sampleRates[0];
|
let bestSr = sampleRates[0];
|
||||||
@@ -472,11 +472,11 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
super.componentWillUnmount();
|
super.componentWillUnmount();
|
||||||
this.mounted = false;
|
this.mounted = false;
|
||||||
this.stopStatusTimer();
|
this.stopStatusTimer();
|
||||||
if (this.originalJackServerSettings) {
|
|
||||||
this.model.setJackServerSettings(this.originalJackServerSettings);
|
|
||||||
this.originalJackServerSettings = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
getSelectedDevice(deviceId: string): AlsaDeviceInfo | undefined {
|
getSelectedDevice(deviceId: string): AlsaDeviceInfo | undefined {
|
||||||
@@ -562,9 +562,9 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
let s = this.state.jackServerSettings.clone();
|
let s = this.state.jackServerSettings.clone();
|
||||||
s.valid = true;
|
s.valid = true;
|
||||||
this.props.onApply(s);
|
this.props.onApply(s);
|
||||||
// Prevent componentWillUnmount from reverting after the
|
|
||||||
// settings have been saved.
|
|
||||||
this.originalJackServerSettings = undefined;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
handleWarningProceed() {
|
handleWarningProceed() {
|
||||||
@@ -619,18 +619,18 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
if (this.originalJackServerSettings) {
|
if (this.originalJackServerSettings) {
|
||||||
this.model.setJackServerSettings(this.originalJackServerSettings);
|
this.model.setJackServerSettings(this.originalJackServerSettings);
|
||||||
this.originalJackServerSettings = undefined;
|
|
||||||
}
|
}
|
||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
const sortedDevices = sortDevices(this.state.alsaDevices ?? []);
|
const sortedDevices = sortDevices(this.state.alsaDevices ?? []);
|
||||||
|
|
||||||
let selectedInputDevice = this.getSelectedDevice(this.state.jackServerSettings.alsaInputDevice);
|
let selectedInputDevice = this.getSelectedDevice(this.state.jackServerSettings.alsaInputDevice);
|
||||||
let selectedOutputDevice = this.getSelectedDevice(this.state.jackServerSettings.alsaOutputDevice);
|
let selectedOutputDevice = this.getSelectedDevice(this.state.jackServerSettings.alsaOutputDevice);
|
||||||
|
|
||||||
const devicesSelected = (selectedInputDevice && selectedOutputDevice);
|
const devicesSelected = (selectedInputDevice && selectedOutputDevice);
|
||||||
|
|
||||||
let bufferSizes: number[] = devicesSelected ?
|
let bufferSizes: number[] = devicesSelected ?
|
||||||
getValidBufferSizesMultiple(selectedInputDevice, selectedOutputDevice) : [];
|
getValidBufferSizesMultiple(selectedInputDevice, selectedOutputDevice) : [];
|
||||||
let bufferCounts = devicesSelected ?
|
let bufferCounts = devicesSelected ?
|
||||||
@@ -641,7 +641,7 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
intersectArrays(selectedInputDevice.sampleRates, selectedOutputDevice.sampleRates)
|
intersectArrays(selectedInputDevice.sampleRates, selectedOutputDevice.sampleRates)
|
||||||
: [];
|
: [];
|
||||||
let sampleRateOptions = sampleRates.length === 0 && this.state.jackServerSettings.sampleRate ? [this.state.jackServerSettings.sampleRate] : sampleRates;
|
let sampleRateOptions = sampleRates.length === 0 && this.state.jackServerSettings.sampleRate ? [this.state.jackServerSettings.sampleRate] : sampleRates;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DialogEx tag="jack" onClose={handleClose} aria-labelledby="select-channels-title" open={open}
|
<DialogEx tag="jack" onClose={handleClose} aria-labelledby="select-channels-title" open={open}
|
||||||
@@ -802,4 +802,4 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
},
|
},
|
||||||
styles);
|
styles);
|
||||||
|
|
||||||
export default JackServerSettingsDialog;
|
export default JackServerSettingsDialog;
|
||||||
Reference in New Issue
Block a user