mirror of
https://github.com/openai/codex.git
synced 2026-11-21 22:50:37 +00:00
## 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
33 lines
903 B
Rust
33 lines
903 B
Rust
//! Keep non-native helper targets buildable without linking a host audio backend.
|
|
|
|
use std::io;
|
|
|
|
pub(super) struct Devices;
|
|
|
|
impl Devices {
|
|
pub(super) fn receive(&self, _: crate::incoming::ReceivedRtp) -> io::Result<()> {
|
|
Self::open().map(|_| ())
|
|
}
|
|
|
|
pub(super) fn take_state(&self) -> io::Result<codex_realtime_webrtc::AudioState> {
|
|
Self::open().map(|_| codex_realtime_webrtc::AudioState::default())
|
|
}
|
|
|
|
pub(super) fn open() -> io::Result<Self> {
|
|
Err(io::Error::other(
|
|
"audio devices unavailable for this helper target",
|
|
))
|
|
}
|
|
|
|
pub(super) fn set_controls(&self, _: codex_realtime_webrtc::AudioControls) -> io::Result<()> {
|
|
Self::open().map(|_| ())
|
|
}
|
|
|
|
pub(super) async fn service(
|
|
&mut self,
|
|
_: &mut crate::audio_track::AudioTrack,
|
|
) -> io::Result<usize> {
|
|
Self::open().map(|_| 0)
|
|
}
|
|
}
|