mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
Drain queued packets before audio ticks in the connector
After a stall (CPU steal on the host), the missed 20 ms ticks fire in a burst. With an unbiased select a tick could run before the already received voice packets were processed, find an empty queue and play Opus loss concealment, which sounds like a slowed-down tape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
1 parent
983ce1e105
commit
5e7add6dc8
1 file changed
+4
@@ -1148,6 +1148,10 @@ async fn run(args: Args) -> Result<()> {
|
||||
loop {
|
||||
let mut events = con.events();
|
||||
let outcome = tokio::select! {
|
||||
// After a stall (e.g. CPU steal) the missed audio ticks fire in a burst.
|
||||
// Polling in order drains the queued packets first, otherwise a tick can
|
||||
// find an empty queue and play Opus loss concealment instead.
|
||||
biased;
|
||||
line = stdin_lines.next_line() => LoopOutcome::StdinLine(line),
|
||||
ev = events.next() => LoopOutcome::ConEvent(ev),
|
||||
_ = audio_ticker.tick() => LoopOutcome::AudioTick,
|
||||
|
||||
Reference in new issue
Block a user