feat(dred): continuous DRED tuning, PMTUD, extended Opus6k window
- DredTuner: maps live network metrics (loss/RTT/jitter) to continuous DRED duration every ~500ms instead of discrete tier-locked values. Includes jitter-spike detection for pre-emptive Starlink-style boost. - Opus6k DRED extended from 500ms to 1040ms (max libopus 1.5 supports) - PMTUD: quinn MtuDiscoveryConfig with upper_bound=1452, 300s interval - TrunkedForwarder respects discovered MTU (was hard-coded 1200) - QuinnPathSnapshot exposes quinn internal stats + discovered MTU - AudioEncoder trait: set_expected_loss() + set_dred_duration() methods - PathMonitor: sliding-window jitter variance for spike detection - Integrated into both Android and desktop send tasks in engine.rs - 14 new tests (10 tuner unit + 4 encoder integration) - Updated ARCHITECTURE.md, PROGRESS.md, PRD-dred-integration, PRD-mtu Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -382,18 +382,32 @@ impl TrunkedForwarder {
|
||||
/// Create a new trunked forwarder.
|
||||
///
|
||||
/// `session_id` tags every entry pushed into the batcher so the receiver
|
||||
/// can demultiplex packets by session.
|
||||
/// can demultiplex packets by session. The batcher's `max_bytes` is
|
||||
/// initialized from the transport's current PMTUD-discovered MTU so that
|
||||
/// trunk frames fill the largest datagram the path supports (instead of
|
||||
/// the conservative 1200-byte default).
|
||||
pub fn new(transport: Arc<wzp_transport::QuinnTransport>, session_id: [u8; 2]) -> Self {
|
||||
let mut batcher = TrunkBatcher::new();
|
||||
if let Some(mtu) = transport.max_datagram_size() {
|
||||
batcher.max_bytes = mtu;
|
||||
}
|
||||
Self {
|
||||
transport,
|
||||
batcher: TrunkBatcher::new(),
|
||||
batcher,
|
||||
session_id,
|
||||
}
|
||||
}
|
||||
|
||||
/// Push a media packet into the batcher. If the batcher is full it will
|
||||
/// flush automatically and the resulting trunk frame is sent immediately.
|
||||
///
|
||||
/// Also refreshes `max_bytes` from the transport's PMTUD-discovered MTU
|
||||
/// so the batcher fills larger datagrams as the path MTU grows.
|
||||
pub async fn send(&mut self, pkt: &wzp_proto::MediaPacket) -> anyhow::Result<()> {
|
||||
// Refresh batcher limit from PMTUD (cheap: reads an atomic in quinn).
|
||||
if let Some(mtu) = self.transport.max_datagram_size() {
|
||||
self.batcher.max_bytes = mtu;
|
||||
}
|
||||
let payload: Bytes = pkt.to_bytes();
|
||||
if let Some(frame) = self.batcher.push(self.session_id, payload) {
|
||||
self.send_frame(&frame)?;
|
||||
|
||||
@@ -52,6 +52,7 @@ fn alice_offer(call_id: &str) -> SignalMessage {
|
||||
supported_profiles: vec![],
|
||||
caller_reflexive_addr: Some(ALICE_ADDR.into()),
|
||||
caller_local_addrs: Vec::new(),
|
||||
caller_build_version: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,6 +133,7 @@ fn bob_answer(call_id: &str) -> SignalMessage {
|
||||
chosen_profile: None,
|
||||
callee_reflexive_addr: Some(BOB_ADDR.into()),
|
||||
callee_local_addrs: Vec::new(),
|
||||
callee_build_version: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,6 +105,7 @@ fn mk_offer(call_id: &str, caller_reflexive_addr: Option<&str>) -> SignalMessage
|
||||
supported_profiles: vec![],
|
||||
caller_reflexive_addr: caller_reflexive_addr.map(String::from),
|
||||
caller_local_addrs: Vec::new(),
|
||||
caller_build_version: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +123,7 @@ fn mk_answer(
|
||||
chosen_profile: None,
|
||||
callee_reflexive_addr: callee_reflexive_addr.map(String::from),
|
||||
callee_local_addrs: Vec::new(),
|
||||
callee_build_version: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user