feat: stabilize voice activity and audio routing

This commit is contained in:
Edison Jwa
2026-05-25 01:19:09 +09:00
parent eb9014cd81
commit 5515ff6643
34 changed files with 3054 additions and 1751 deletions
@@ -203,8 +203,8 @@ impl Default for AndroidVoiceStreamConfig {
Self {
sample_rate: 48_000,
channel_count: 1,
request_low_latency: true,
request_exclusive: true,
request_low_latency: false,
request_exclusive: false,
effects: AudioEffects::default(),
}
}
@@ -488,7 +488,7 @@ impl fmt::Display for AchievedInputPreset {
#[derive(Debug, Clone)]
pub struct AndroidAudioDiagnostics {
// Requested side (SDD-112 items 4..7) — fixed by SDD-112.
/// Requested performance mode (always "LowLatency" in P0).
/// Requested performance mode for the current Android request profile.
pub requested_performance_mode: &'static str,
/// Requested output usage (always "VoiceCommunication" in P0).
pub requested_usage: &'static str,
@@ -496,7 +496,7 @@ pub struct AndroidAudioDiagnostics {
pub requested_content_type: &'static str,
/// Requested input preset (always "VoiceCommunication" first).
pub requested_input_preset: &'static str,
/// Requested sharing mode (always "Exclusive" first).
/// Requested sharing mode for the current Android request profile.
pub requested_sharing_mode: &'static str,
/// Requested sample rate (Hz).
pub requested_sample_rate_hz: u32,
@@ -640,15 +640,15 @@ pub fn current_android_audio_diagnostics() -> Option<AndroidAudioDiagnostics> {
mod tests {
use super::*;
/// SWE4-UV-047: default config records requested low-latency,
/// exclusive sharing, mono 48 kHz, and default effects.
/// SWE4-UV-047: default config records the conservative shared
/// voice-input request profile, mono 48 kHz, and default effects.
#[test]
fn swe4_uv_047_default_config_records_requested_values() {
let cfg = AndroidVoiceStreamConfig::default();
assert_eq!(cfg.sample_rate, 48_000);
assert_eq!(cfg.channel_count, 1);
assert!(cfg.request_low_latency);
assert!(cfg.request_exclusive);
assert!(!cfg.request_low_latency);
assert!(!cfg.request_exclusive);
// AudioEffects defaults are all-on per DEC-007..010.
assert!(cfg.effects.aec);
assert!(cfg.effects.noise_suppression);
@@ -702,7 +702,9 @@ mod tests {
);
}
/// SWE4-UV-049: sharing-mode ladder is Exclusive -> Shared -> exhausted.
/// SWE4-UV-049: sharing-mode ladder remains Exclusive -> Shared -> exhausted.
/// The default request profile may start at Shared, but the ladder still
/// exists for explicitly opt-in low-latency / exclusive experiments.
#[test]
fn swe4_uv_049_sharing_mode_fallback_ladder_order() {
assert_eq!(