Startup crash; crash when no audio device

This commit is contained in:
Robin Davies
2021-10-18 14:57:10 -04:00
parent 11b2a94b17
commit 416f9ff3cf
9 changed files with 93 additions and 50 deletions
+29 -24
View File
@@ -552,39 +552,44 @@ int main(int argc, char *argv[])
}
}
}
// pre-cache device info before we let audio services run.
model.GetAlsaDevices();
}
// Get heavy IO out of the way before letting dependent (Jack) services run.
model.LoadLv2PluginInfo(configuration);
// Get heavy IO out of the way before letting dependent (Jack) services run.
model.LoadLv2PluginInfo(configuration);
if (systemd)
{
// Tell systemd we're done.
sd_notify(0, "READY=1");
sd_notifyf(0, "READY=1\n"
"MAINPID=%lu",
(unsigned long) getpid());
}
if (!isJackServiceRunning())
if (!isJackServiceRunning())
{
Lv2Log::info("Waiting for Jack service.");
// wait up to 15 seconds for the jack service to come online.
for (int i = 0; i < 15; ++i)
{
Lv2Log::info("Waiting for Jack service.");
// wait up to 15 seconds for the jack service to come online.
for (int i = 0; i < 15; ++i)
{
// use the time to prepopulate ALSA device cache before jack
// opens the device and we can't read properties.
model.GetAlsaDevices();
// use the time to prepopulate ALSA device cache before jack
// opens the device and we can't read properties.
model.GetAlsaDevices();
sleep(1);
if (isJackServiceRunning())
{
break;
}
sleep(1);
if (isJackServiceRunning())
{
break;
}
}
if (isJackServiceRunning())
{
Lv2Log::info("Found Jack service.");
sleep(3); // jack needs a little time to get up to speed.
} else {
Lv2Log::info("Jack service not started.");
}
}
if (isJackServiceRunning())
{
Lv2Log::info("Found Jack service.");
sleep(3); // jack needs a little time to get up to speed.
} else {
Lv2Log::info("Jack service not started.");
}
model.Load(configuration);