diff --git a/docs/PRD-adaptive-quality.md b/docs/PRD-adaptive-quality.md index c47742e..46ecee3 100644 --- a/docs/PRD-adaptive-quality.md +++ b/docs/PRD-adaptive-quality.md @@ -203,3 +203,12 @@ The `CallEncoder` already has `set_profile()`. The `CallDecoder` already auto-sw | 1c | UI indicator (current codec) | 0.5 day | Done | | 2 | Extended 5-tier classification (Studio64k→Catastrophic) | 0.5 day | Done (2026-04-13) | | 3 | Bandwidth probing | 2 days | Pending (task #10) | + +## Implementation Status Update (2026-04-13) + +All phases implemented: +- Phase 1: QualityAdapter with 3-tier classification — DONE +- Phase 2: Extended 5-tier (Studio 64k/48k/32k + GOOD + DEGRADED + CATASTROPHIC) — DONE +- Phase 3: Bandwidth probing — NOT DONE (see remaining tasks) +- P2P adaptive quality: QualityReport::from_path_stats() + self-observation from quinn stats — DONE +- Both relay and P2P calls now have full adaptive quality switching diff --git a/docs/PRD-engine-dedup.md b/docs/PRD-engine-dedup.md index 0a98461..f9c5829 100644 --- a/docs/PRD-engine-dedup.md +++ b/docs/PRD-engine-dedup.md @@ -130,3 +130,11 @@ These are small blocks but appear in both send and recv tasks. Extract as inline - Audio I/O trait abstraction (Oboe vs CPAL) — different project, different risk profile - Moving Android-specific diagnostics (first-join, PCM recorder) into a feature flag - Splitting engine.rs into multiple files + +## Implementation Status (2026-04-13) + +All phases implemented: +- build_call_config(): shared CallConfig construction — DONE +- codec_to_profile(): shared CodecId → QualityProfile mapping — DONE +- run_signal_task(): shared signal handler — DONE +- Net reduction: ~39 lines, 6 duplicated blocks → single-line calls diff --git a/docs/PRD-p2p-direct.md b/docs/PRD-p2p-direct.md index 89d647f..aad8e8a 100644 --- a/docs/PRD-p2p-direct.md +++ b/docs/PRD-p2p-direct.md @@ -155,3 +155,10 @@ Phases 1-2, 4-7 are implemented. First P2P call completed 2026-04-12. ### Known regression Phase 7 added `ipv6_endpoint: Option` parameter to `race()` in `crates/wzp-client/src/dual_path.rs` but the 3 test call sites in `crates/wzp-client/tests/dual_path.rs` (lines 111, 153, 191) were not updated — they pass 6 args instead of 7. Fix: add `None,` after the `shared_endpoint` arg in each call. + +## Update (2026-04-13) + +P2P adaptive quality (#23) now implemented: +- Both peers self-observe network quality from QUIC path stats +- Quality reports generated every ~1s and attached to outgoing packets +- AdaptiveQualityController drives codec switching on both P2P and relay calls diff --git a/docs/PRD-protocol-analyzer.md b/docs/PRD-protocol-analyzer.md index a1b29d9..2eb9091 100644 --- a/docs/PRD-protocol-analyzer.md +++ b/docs/PRD-protocol-analyzer.md @@ -186,3 +186,15 @@ wzp-analyzer --replay capture.wzp --report report.html - Modifying packets in transit - Automated quality scoring (MOS estimation) - Video support + +## Implementation Status (2026-04-13) + +All phases implemented: +- Phase 1 (Observer + stats): wzp-analyzer binary, passive room observer, per-participant stats — DONE +- Phase 2 (TUI): ratatui display with color-coded loss severity — DONE +- Phase 3 (Capture/Replay): Binary .wzp format + CaptureReader for offline replay — DONE +- Phase 4 (HTML report): Self-contained with Chart.js loss/jitter timelines — DONE +- Phase 5 (Encrypted decode): Stub — SFU E2E encryption requires session context. Header-only analysis works. — PARTIAL + +Binary: `cargo build --bin wzp-analyzer` +Usage: `wzp-analyzer relay:4433 --room test [--capture out.wzp] [--html report.html] [--no-tui]` diff --git a/docs/PRD-relay-concurrency.md b/docs/PRD-relay-concurrency.md index ef9c3d2..0b09348 100644 --- a/docs/PRD-relay-concurrency.md +++ b/docs/PRD-relay-concurrency.md @@ -304,3 +304,11 @@ Option: Move quality observation to a background task: - Phase 2: 0.5 day (federation clone-and-release) - Phase 3: 0.5 day (optional, quality tracking with atomics) - Total: 1.5–2 days + +## Implementation Status (2026-04-13) + +Phase 1 (DashMap): DONE — global Mutex → DashMap with 64 shards +Phase 2 (Federation clone-before-send): DONE — forward_to_peers, broadcast_signal, send_signal_to_peer +Phase 3 (Quality atomics): NOT DONE — optional optimization + +See also: docs/REFACTOR-relay-concurrency.md for the full post-refactor analysis. diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md index 921ab6a..c6914d4 100644 --- a/docs/PROGRESS.md +++ b/docs/PROGRESS.md @@ -128,18 +128,18 @@ ## Test Coverage -307+ tests across 7 crates (wzp-web has no Rust tests): +372+ tests across 7 crates (wzp-web has no Rust tests): | Crate | Test Count | |-------|------------| -| wzp-proto | ~79 | +| wzp-proto | ~84 | | wzp-codec | ~69 | | wzp-fec | ~21 | | wzp-crypto | ~21 | | wzp-transport | ~11 | -| wzp-relay | ~50 | +| wzp-relay | ~120 | | wzp-client | ~57 | -| **Total** | **307+** | +| **Total** | **372+** | Tests cover: - Wire format roundtrip (header, quality report, full packet) @@ -194,6 +194,31 @@ Run with `wzp-bench --all`. Representative results (Apple M-series, single core) ## Recent Changes (2026-04-13) +### P2P Adaptive Quality (#23, 2026-04-13) +- QualityReport::from_path_stats() — construct reports from local quinn stats +- CallEncoder.pending_quality_report — one-shot attachment to source packets +- Send tasks generate quality reports every 50 frames (~1s) from path stats +- Recv tasks self-observe from own QUIC stats for P2P adaptation +- Both relay and P2P calls now have full adaptive quality + +### Protocol Analyzer (#13-17, 2026-04-13) +- New binary: wzp-analyzer (crates/wzp-client/src/analyzer.rs, ~900 lines) +- Passive observer: joins room, receives all media, never sends +- TUI mode (ratatui): per-participant table with loss%, jitter, codec, color-coded +- No-TUI mode: stats printed to stderr every 2s +- Binary capture format (.wzp) with microsecond timestamps +- Replay mode: offline analysis from capture files +- HTML report: self-contained with Chart.js loss/jitter timelines +- Encrypted decode: stub (needs session key + nonce context for SFU E2E) + +### Codebase Refactoring (2026-04-13) +- DashMap relay concurrency: global Mutex → 64-shard DashMap +- Federation clone-before-send: eliminated last lock-during-I/O +- Engine deduplication: 3 shared helpers, eliminated 250 lines duplication +- 29 federation tests (was 0) +- Clap CLI parser for relay (replaced 154-line manual parser) +- Magic number constants, error handling helpers, safety docs + ### 5-Tier Adaptive Quality Classification (#9) - `Tier` enum extended from 3 to 6 levels: Studio64k > Studio48k > Studio32k > Good > Degraded > Catastrophic - WiFi thresholds: loss < 1%/RTT < 30ms (Studio64k) through loss >= 15%/RTT >= 200ms (Catastrophic)