fix(host): close desktop audio failure gates
This commit is contained in:
+21
-12
@@ -11,8 +11,8 @@ use super::aec::AecConfig;
|
||||
use super::audio::parse_object_serial;
|
||||
use super::fanout::FanoutController;
|
||||
use super::health;
|
||||
use super::observer::Readiness;
|
||||
use super::observer::adapter::{FanoutControl, RegistryObserverHandle};
|
||||
use super::observer::{Projection, Readiness};
|
||||
use super::owned_thread::OwnedThread;
|
||||
use super::taint::snapshot::{GlobalId, Serial};
|
||||
use crate::common::output::AudioExclusionEvent;
|
||||
@@ -293,17 +293,9 @@ async fn wait_for_fanout_ready(
|
||||
) -> Result<()> {
|
||||
let deadline = Instant::now() + FANOUT_READY_BUDGET;
|
||||
loop {
|
||||
if let Some(projection) = observer.latest() {
|
||||
if projection.readiness == Readiness::TimedOut {
|
||||
bail!("registry observer reached its sticky readiness timeout");
|
||||
}
|
||||
let sink_is_current = projection
|
||||
.snapshot
|
||||
.node(Serial(identity.serial))
|
||||
.is_some_and(|node| node.id == GlobalId(identity.global_id));
|
||||
if projection.graph_ready && sink_is_current {
|
||||
return Ok(());
|
||||
}
|
||||
let projection = observer.latest();
|
||||
if fanout_readiness(projection.as_ref(), identity)? {
|
||||
return Ok(());
|
||||
}
|
||||
if Instant::now() >= deadline {
|
||||
bail!(
|
||||
@@ -315,6 +307,23 @@ async fn wait_for_fanout_ready(
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn fanout_readiness(
|
||||
projection: Option<&Projection>,
|
||||
identity: &SinkIdentity,
|
||||
) -> Result<bool> {
|
||||
let Some(projection) = projection else {
|
||||
return Ok(false);
|
||||
};
|
||||
if projection.readiness == Readiness::TimedOut {
|
||||
bail!("registry observer reached its sticky readiness timeout");
|
||||
}
|
||||
let sink_is_current = projection
|
||||
.snapshot
|
||||
.node(Serial(identity.serial))
|
||||
.is_some_and(|node| node.id == GlobalId(identity.global_id));
|
||||
Ok(projection.graph_ready && sink_is_current)
|
||||
}
|
||||
|
||||
impl AudioGraphOwner {
|
||||
pub(super) async fn start(
|
||||
filter_name: Option<String>,
|
||||
|
||||
Reference in New Issue
Block a user