realtime: fix output format rate and smooth playback buffer

This commit is contained in:
Ahmed Ibrahim
2026-03-04 17:09:40 -08:00
parent f13917d50e
commit 159bda93c6
3 changed files with 90 additions and 15 deletions
@@ -347,6 +347,7 @@ impl RealtimeWebsocketWriter {
output: SessionAudioOutput {
format: SessionAudioOutputFormat {
kind: "audio/pcm".to_string(),
rate: 24_000,
},
voice: "marin".to_string(),
},
@@ -902,6 +903,10 @@ mod tests {
first_json["session"]["audio"]["output"]["format"]["type"],
Value::String("audio/pcm".to_string())
);
assert_eq!(
first_json["session"]["audio"]["output"]["format"]["rate"],
Value::from(24_000)
);
assert_eq!(
first_json["session"]["audio"]["output"]["voice"],
Value::String("marin".to_string())
@@ -67,6 +67,7 @@ pub(super) struct SessionAudioOutput {
pub(super) struct SessionAudioOutputFormat {
#[serde(rename = "type")]
pub(super) kind: String,
pub(super) rate: u32,
}
#[derive(Debug, Clone, Serialize)]