mirror of
https://github.com/ratspeak/rsLXST
synced 2026-11-22 23:10:37 +00:00
opus: the Medium profile stays wideband, set explicitly
This commit is contained in:
1 parent
edc6187472
commit
0b2a55aadd
3 files changed
+13
-11
No files matched your search
+3
-3
@@ -24,9 +24,9 @@ Parity with Python LXST 0.6.0. Several experimental APIs change.
|
||||
- `opus-rs` moves from 0.1.29 to 0.1.42, which fixes a decoder panic on a
|
||||
crafted SILK frame. A decoder panic on a peer's packet now rejects the
|
||||
packet and resets the decoder.
|
||||
- The Medium voice profile encodes narrowband SILK at its 8 kbps ceiling, as
|
||||
libopus does under Python LXST; it was wideband. The encoder takes the
|
||||
profile's own sample rate.
|
||||
- The Medium voice profile stays wideband SILK at its 8 kbps ceiling, now by
|
||||
an explicit bandwidth setting; the encoder takes the profile's own sample
|
||||
rate. (libopus 1.5 picks wideband there and libopus 1.6 narrowband.)
|
||||
- `lxst-embedded` sessions default to the 60, 70, and 5 second ring, wait,
|
||||
and connect times; `SessionConfig::times` (`CallTimes`) changes them.
|
||||
- A caller is established once it has handled CONNECTING, so a lost
|
||||
|
||||
@@ -39,7 +39,6 @@ matches on `lxst_telephony::Error` need a new arm.
|
||||
settings, as upstream does.
|
||||
- Call links signal the next hop's MTU when Reticulum's `link_mtu_discovery`
|
||||
is on (`RNS/Link.py:392-397`).
|
||||
- The Medium voice profile encodes narrowband SILK at its 8 kbps ceiling, as
|
||||
libopus does under Python LXST. It was wideband. Decoders are unaffected.
|
||||
- The Medium voice profile still encodes wideband SILK at its 8 kbps ceiling.
|
||||
- `opus-rs` is pinned at 0.1.42 (was 0.1.29).
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use std::panic::{AssertUnwindSafe, catch_unwind};
|
||||
|
||||
use opus_rs::{Application, OpusDecoder, OpusEncoder};
|
||||
use opus_rs::{Application, Bandwidth, OpusDecoder, OpusEncoder};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::{AudioCodec, CodecKind, Frame, OpusApplication, Profile, RawAudioFrame};
|
||||
use crate::{AudioCodec, CodecKind, Frame, OpusApplication, OpusProfile, Profile, RawAudioFrame};
|
||||
|
||||
/// The fixed output clock used by the interoperable Opus packet decoder.
|
||||
pub const OPUS_MONO_DECODE_SAMPLE_RATE_HZ: u32 = 48_000;
|
||||
@@ -90,6 +90,11 @@ impl OpusEncoderState {
|
||||
.map_err(|err| OpusCodecError::Codec(err.to_string()))?;
|
||||
encoder.bitrate_bps = opus_profile.bitrate_ceiling() as i32;
|
||||
encoder.use_cbr = false;
|
||||
if matches!(opus_profile, OpusProfile::VoiceMedium) {
|
||||
// At 8 kbps libopus builds disagree (1.5 wideband, 1.6 narrowband); wideband is
|
||||
// what this profile has always sent.
|
||||
encoder.set_bandwidth(Bandwidth::Wideband);
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
profile,
|
||||
@@ -1067,7 +1072,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn opus_medium_uses_narrowband_silk_as_libopus_does() {
|
||||
fn opus_medium_uses_wideband_silk_at_low_bitrate() {
|
||||
let profile = Profile::QualityMedium;
|
||||
let mut source = source_for(profile);
|
||||
let frame = source.next_raw_frame().unwrap();
|
||||
@@ -1075,9 +1080,7 @@ mod tests {
|
||||
|
||||
let encoded = encoder.encode_frame(&frame).unwrap();
|
||||
|
||||
// Config 1, SILK narrowband 20 ms: libopus 1.6.1 under LXST 0.6.0 picks the same
|
||||
// bandwidth at Medium's 8 kbps ceiling.
|
||||
assert_eq!(encoded.payload[0] & !0x03, 0x08);
|
||||
assert_eq!(encoded.payload[0] & !0x03, 0x48);
|
||||
assert!(encoded.payload.len() <= profile.opus_payload_ceiling_bytes().unwrap());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user