mirror of
https://github.com/openai/codex.git
synced 2026-11-29 00:00:54 +00:00
Refresh the speaker format when restarting voice output (#44924)
## Why Opening a Bluetooth microphone can change the speaker format, leaving the previously cached sample rate unsupported when the speaker stream restarts. ## What changed Requery and validate the speaker configuration after stopping the old stream. Update playback and render resampling to the current sample rate, and revalidate callback timing. Discard stale echo references while preserving capture history and audio processing state. ## Testing Extend the speaker reset test to cover 48, 24, and 44.1 kHz output rates, checking that render output matches a fresh converter while capture history and pending samples are preserved. GitOrigin-RevId: 3a4fba577288a83a7509fc78be86171ac85a3c0a
This commit is contained in:
committed by
copyberry
parent
ce7fbb373b
commit
7ef70f95d5
@@ -151,6 +151,15 @@ impl Processor {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn set_render_rate(&mut self, rate: u32) -> Result<()> {
|
||||
// Capture keeps its own rate and history across speaker-only changes.
|
||||
if self.render.rate != rate {
|
||||
self.render = Converter::new(rate)?;
|
||||
}
|
||||
self.reset_render();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn reset_render(&mut self) {
|
||||
// Speaker changes discard old references without resetting capture or APM state.
|
||||
self.render.resampler.reset();
|
||||
|
||||
Reference in New Issue
Block a user