Connect voice-host RTP audio to speaker playback (#43248)

## Why

The voice host drained incoming RTP packets without playing them. Route received audio through decoding and speaker output while preserving speaker suppression boundaries.

## What changed

- Add a GStreamer pipeline with RTP jitter buffering, Opus decoding, conversion, and resampling into the native speaker sink.
- Rebuild playout when the speaker is re-enabled, reject packets received before the new pipeline started, and discard queued audio and echo references on speaker transitions while preserving capture history.
- Limit each receive pass to 64 packets so incoming media cannot indefinitely delay audio controls.
- Prevent retired sink failures from failing a new speaker generation, and retain the last coherent playback delay estimate during callback contention.

## Testing

Add tests for real Opus playback and stale packet rejection, combined microphone mute and speaker suppression, retired sink failures, delay contention, and echo-reference reset without losing capture history.

GitOrigin-RevId: c91c94a2ba2347ac98af4e7fd1dc331ae766cc45
This commit is contained in:
Benjamin Carlsson authored and copyberry committed 2026-09-06 16:40:33 +00:00
1 parent 9daf7d22ca
commit a9896da3fe
17 files changed
+713 -39

No files matched your search

+4 -1
View File
@@ -23,13 +23,16 @@ impl CaptureWorker {
&mut self,
controls: codex_realtime_webrtc::AudioControls,
) -> io::Result<()> {
// Retire the old sink before rebuilding microphone processing.
self.buffers
.set_speaker_disabled(controls.speaker_suppressed)?;
let previous = self.buffers.microphone.load(Ordering::Acquire);
Buffers::set_disabled(&self.buffers.microphone, controls.microphone_muted)?;
if previous != self.buffers.microphone.load(Ordering::Acquire) {
self.pending.clear();
self.processor.reset().map_err(io::Error::other)?;
}
Buffers::set_disabled(&self.buffers.speaker, controls.speaker_suppressed)
Ok(())
}
pub(super) async fn service(