Don't retry the _pa ipc at a Linux login screen (#16390)

At a greeter the cm is not started, so the `_pa` socket never exists and
the audio service fails to connect and logs an error once per second for
as long as a client is connected. Wait in `pa_impl::run` while
`is_prelogin()` is true; audio starts once a user logs in.

Fixes #16012
This commit is contained in:
berce authored and GitHub committed 2026-09-29 10:17:06 +08:00
1 parent 0c18a8cbc9
commit 40a4aa34c8
1 file changed
+11
+11
View File
@@ -97,6 +97,17 @@ mod pa_impl {
pub async fn run(sp: EmptyExtraFieldService) -> ResultType<()> {
hbb_common::sleep(0.1).await; // one moment to wait for _pa ipc
RESTARTING.store(false, Ordering::SeqCst);
// The `_pa` ipc is served by the cm, which is not started at a login
// screen, so connecting there fails and logs an error every second.
// Wait here instead; audio starts once a user logs in. Poll slowly,
// `is_prelogin` spawns a process on every call.
#[cfg(target_os = "linux")]
while crate::platform::is_prelogin() {
if !sp.ok() {
return Ok(());
}
hbb_common::sleep(3.).await;
}
#[cfg(target_os = "linux")]
let mut stream = crate::ipc::connect(1000, "_pa").await?;
let mut encoder = AudioEncoder::new(Encoder::new(