diff --git a/api/README.md b/api/README.md index 00a4558..a392d30 100644 --- a/api/README.md +++ b/api/README.md @@ -61,9 +61,9 @@ version consequences must be reviewed before accepting new evidence. ## Live audio and constrained peers `SendAudioFrames`, `StartAudioStream` and the corresponding receive/stop controls -accept negotiated Opus and native Codec2 1600/3200 profiles. Original Opus +accept negotiated Opus and native Codec2 700C/1600/3200 profiles. Original Opus controls remain available. Codec2 media emits `Audio*` service events; the -existing Opus event stream is unchanged. 700C is not implemented. +existing Opus event stream is unchanged. Standard ULBW uses ten four-byte 700C frames per 400 ms packet. `StartAudioStream` binds the exact active Link and optionally shares an `AudioTransmitGate` with the local input owner. Renew one press serial while diff --git a/crates/lxst-embedded/src/session.rs b/crates/lxst-embedded/src/session.rs index 9077d3e..b5c4601 100644 --- a/crates/lxst-embedded/src/session.rs +++ b/crates/lxst-embedded/src/session.rs @@ -11,7 +11,7 @@ pub const TALK_LIMIT_MS: u64 = 30_000; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct ProfileSet(u8); impl ProfileSet { - pub const CODEC2: Self = Self(0b0000_0110); + pub const CODEC2: Self = Self(0b0000_0111); pub const OPUS_MEDIUM: Self = Self(0b0000_1000); pub const fn contains(self, profile: Profile) -> bool { self.0 & (1 << (profile.wire_value() / 16 - 1)) != 0 diff --git a/crates/lxst-embedded/tests/queue_codec.rs b/crates/lxst-embedded/tests/queue_codec.rs index a479442..0cff64b 100644 --- a/crates/lxst-embedded/tests/queue_codec.rs +++ b/crates/lxst-embedded/tests/queue_codec.rs @@ -29,6 +29,12 @@ fn stalled_media_drops_old_frames_and_never_crosses_generations() { #[test] fn borrowed_native_backend_runs_shared_packet_adapter_without_state_moves() { for (mode, profile, bytes, samples) in [ + ( + lxst_codec2::Mode::Rate700C, + Profile::BandwidthUltraLow, + 41, + 3200, + ), ( lxst_codec2::Mode::Rate1600, Profile::BandwidthVeryLow, @@ -41,12 +47,12 @@ fn borrowed_native_backend_runs_shared_packet_adapter_without_state_moves() { let native = lxst_codec2::Codec::initialise(&mut storage, mode); let mut codec = Codec2PacketCodec::new(profile, native).unwrap(); let mut output = [0xa5; 90]; - let pcm = [0; 2560]; + let pcm = [0; 3200]; assert_eq!( codec.encode_into(&pcm[..samples], &mut output).unwrap(), bytes ); - let mut decoded = [123; 2568]; + let mut decoded = [123; 3208]; assert_eq!( codec.decode_into(&output[..bytes], &mut decoded).unwrap(), samples diff --git a/crates/lxst-embedded/tests/session.rs b/crates/lxst-embedded/tests/session.rs index 4549708..9b62c78 100644 --- a/crates/lxst-embedded/tests/session.rs +++ b/crates/lxst-embedded/tests/session.rs @@ -7,6 +7,9 @@ use lxst_embedded::{ fn crossed_profile_offers_converge_before_media_without_an_echo_loop() { for (preferred, offered) in [ (Profile::BandwidthLow, Profile::BandwidthVeryLow), + (Profile::BandwidthLow, Profile::BandwidthUltraLow), + (Profile::BandwidthUltraLow, Profile::BandwidthVeryLow), + (Profile::BandwidthVeryLow, Profile::BandwidthUltraLow), (Profile::BandwidthVeryLow, Profile::BandwidthLow), ] { let mut cfg = config(); diff --git a/crates/lxst-telephony/src/tests.rs b/crates/lxst-telephony/src/tests.rs index 3449895..6811dac 100644 --- a/crates/lxst-telephony/src/tests.rs +++ b/crates/lxst-telephony/src/tests.rs @@ -3945,7 +3945,11 @@ fn outgoing_teardown_is_atomic_final_endpoint_send() { #[tokio::test] async fn native_codec2_duplex_and_input_lease_use_the_real_link() { use std::sync::Arc; - for profile in [Profile::BandwidthVeryLow, Profile::BandwidthLow] { + for profile in [ + Profile::BandwidthUltraLow, + Profile::BandwidthVeryLow, + Profile::BandwidthLow, + ] { let (mut service, remote, link_id, incoming, mut events, mut transport) = established_outgoing_service_with_transport(profile, 0x95, 32); let gate = Arc::new(AudioTransmitGate::new()); @@ -3990,7 +3994,9 @@ async fn native_codec2_duplex_and_input_lease_use_the_real_link() { assert_eq!(packet.frames[0].codec, CodecKind::Codec2); assert_eq!( packet.frames[0].payload.len(), - if profile == Profile::BandwidthVeryLow { + if profile == Profile::BandwidthUltraLow { + 41 + } else if profile == Profile::BandwidthVeryLow { 65 } else { 81