chore(diagnostics): log when the audio feeder falls behind
- diagnostics.log gets each stall of the mic/far-end feeder with its lag and the last capture_frame time - In the 11-10 share call WebRTC stats stalled 10 s during the share; a feeder stall there makes the echo canceller re-align, which fits Erik hearing himself briefly Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -66,12 +66,18 @@ impl Feeder {
66
66
fn run(mut self) {
67
67
let mut chain = MicChain::new(self.processing, self.ml_noise, StageDumps::from_env());
68
68
let mut due = Instant::now();
69
let mut last_capture = Duration::ZERO;
69
70
while self.running.load(Ordering::SeqCst) {
70
71
due += FRAME_PERIOD;
71
72
let now = Instant::now();
72
73
if due > now {
73
74
std::thread::sleep(due - now);
74
75
} else if now - due > MAX_LAG {
76
eprintln!(
77
"calls: audio feeder fell {} ms behind, last capture_frame took {} ms; echo canceller re-aligns",
78
(now - due).as_millis(),
79
last_capture.as_millis()
80
);
75
81
due = now;
76
82
}
77
83
let (mut far_end, has_far_end) = self.far_end.next_frame();
@@ -90,9 +96,11 @@ impl Feeder {
90
96
num_channels: 1,
91
97
samples_per_channel: FRAME_SAMPLES as u32,
92
98
};
99
let capture_started = Instant::now();
93
100
if self.runtime.block_on(self.source.capture_frame(&frame)).is_err() {
94
101
break;
95
102
}
103
last_capture = capture_started.elapsed();
96
104
}
97
105
}
98
106
}
@@ -66,12 +66,18 @@ impl Feeder {66
fn run(mut self) {66
fn run(mut self) {67
let mut chain = MicChain::new(self.processing, self.ml_noise, StageDumps::from_env());67
let mut chain = MicChain::new(self.processing, self.ml_noise, StageDumps::from_env());68
let mut due = Instant::now();68
let mut due = Instant::now();69
let mut last_capture = Duration::ZERO;69
while self.running.load(Ordering::SeqCst) {70
while self.running.load(Ordering::SeqCst) {70
due += FRAME_PERIOD;71
due += FRAME_PERIOD;71
let now = Instant::now();72
let now = Instant::now();72
if due > now {73
if due > now {73
std::thread::sleep(due - now);74
std::thread::sleep(due - now);74
} else if now - due > MAX_LAG {75
} else if now - due > MAX_LAG {76
eprintln!(77
"calls: audio feeder fell {} ms behind, last capture_frame took {} ms; echo canceller re-aligns",78
(now - due).as_millis(),79
last_capture.as_millis()80
);75
due = now;81
due = now;76
}82
}77
let (mut far_end, has_far_end) = self.far_end.next_frame();83
let (mut far_end, has_far_end) = self.far_end.next_frame();@@ -90,9 +96,11 @@ impl Feeder {90
num_channels: 1,96
num_channels: 1,91
samples_per_channel: FRAME_SAMPLES as u32,97
samples_per_channel: FRAME_SAMPLES as u32,92
};98
};99
let capture_started = Instant::now();93
if self.runtime.block_on(self.source.capture_frame(&frame)).is_err() {100
if self.runtime.block_on(self.source.capture_frame(&frame)).is_err() {94
break;101
break;95
}102
}103
last_capture = capture_started.elapsed();96
}104
}97
}105
}98
}106
}