docs: protocol audit 2026-05-25, update architecture + Obsidian vault

Audit:
- docs/AUDIT-2026-05-25.md: full protocol audit covering 8 findings
  (4 critical, 2 high, 5 medium, 4 low) with code references and fix
  effort estimates
- vault/Audit/Tasks.md: Obsidian Tasks plugin file tracking all audit
  items with priorities, due dates, and per-step checklists

Architecture docs updated for Wire format v2 and Wave 5/6 features:
- ARCHITECTURE.md: adds wzp-video to dependency graph and project
  structure; wire format updated to v2 (16B header, 5B MiniHeader);
  relay concurrency section corrected (DashMap+RwLock is current, not
  a future optimization); test count 571→702; Android note
- PROGRESS.md: Wave 5 and Wave 6 sections appended; test count 372→702;
  current status and open blockers as of 2026-05-25
- ROAD-TO-VIDEO.md: implementation status table inserted (/🟡/🔴/🔲
  per phase); 6-step critical path to first video call
- WZP-SPEC.md: MediaHeader updated to v2 (16B byte-aligned); MiniHeader
  updated to 5B with seq_delta; codec IDs 9-12 added (H.264/H.265/AV1);
  version negotiation section added

Obsidian vault (vault/):
- 114 files across Architecture/, PRDs/, Reports/, Android/,
  Reference/, Audit/ with YAML frontmatter
- 00 - Home.md index note with wiki links
- .obsidian/app.json config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-05-25 06:00:17 +04:00
parent 12b0d9738f
commit ed8a7ae5aa
120 changed files with 22781 additions and 65 deletions

View File

@@ -0,0 +1,91 @@
---
tags: [report, wzp]
type: report
status: Pending Review
---
# T5.5 — 3-layer simulcast at sender
**Status:** Pending Review
**Agent:** Kimi Code CLI
**Started:** 2026-05-12T18:15Z
**Completed:** 2026-05-12T18:45Z
**Commit:** 2f1a9f7
**PRD:** ../PRD-video-simulcast.md
## What I changed
- `crates/wzp-video/src/simulcast.rs` — New file. `SimulcastEncoder<E: VideoEncoder>` driving three layers:
- `LayerConfig { stream_id, width, height, target_bitrate_kbps, target_fps }`
- `SimulcastLayer { config, encoder, active }`
- `encode()` produces `Vec<LayerPacket>` with per-layer payloads
- `request_keyframe()` propagates to all active layers
- `set_layer_mask()` enables/disables layers dynamically
- `crates/wzp-video/src/controller.rs:150-220` — Added `tick_simulcast(now_ms) -> Vec<LayerTarget>`:
- Low layer: 150 kbps, 320×180 @ 15 fps
- Mid layer: 600 kbps, 640×360 @ 24 fps
- High layer: 2500 kbps, 1280×720 @ 30 fps
- Drops layers when BWE is insufficient
- `crates/wzp-video/src/lib.rs` — Re-exported `SimulcastEncoder`, `SimulcastLayer`, `LayerTarget`, `LayerPacket`.
## Why these choices
Three layers is the WebRTC default (low/mid/high). Budget allocation is hard-coded rather than configurable because the PRD specifies a v1 table; future work can make it dynamic. The `stream_id` field in `LayerConfig` maps directly to RTP stream IDs so the SFU can filter by layer without parsing codec headers.
## Deviations from the task spec
None.
## Verification output
```bash
$ cargo test -p wzp-video -- simulcast
Compiling wzp-video v0.1.0
Finished `test` profile [unoptimized + debuginfo] target(s) in 2.29s
Running unittests src/lib.rs (target/debug/deps/wzp_video-...)
running 10 tests
test simulcast::tests::simulcast_all_layers_ordered ... ok
test simulcast::tests::simulcast_layer_total_bitrate ... ok
test simulcast::tests::simulcast_encoder_creates_three_layers ... ok
test simulcast::tests::simulcast_encode_produces_three_packets ... ok
test simulcast::tests::simulcast_request_keyframe_propagates ... ok
test simulcast::tests::simulcast_layer_mask_disables_layers ... ok
test controller::tests::simulcast_all_layers_at_4mbps ... ok
test controller::tests::simulcast_low_mid_only_at_1mbps ... ok
test controller::tests::simulcast_low_only_at_200kbps ... ok
test controller::tests::simulcast_no_video_at_20kbps ... ok
test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 51 filtered out
```
```bash
$ cargo fmt --all -- --check
# pass
```
```bash
$ cargo clippy -p wzp-video --all-targets -- -D warnings
# pass
```
## Test summary
- Tests added: 10
- Tests modified: 0
- Workspace test count before: 61 / after: 71 (wzp-video)
- `cargo clippy -p wzp-video --all-targets -- -D warnings`: pass
- `cargo fmt --all -- --check`: pass
## Risks / follow-ups
1. **Simulcast does not yet wire into Android/Desktop engines** — The encoder exists but no caller creates a `SimulcastEncoder` at runtime. Integration is T6.x scope.
2. **Layer targets are static** — BWE changes only enable/disable layers; resolution/fps within a layer are fixed. Future work: adaptive per-layer quality.
## Reviewer checklist (filled in by reviewer)
- [ ] Code matches PRD intent
- [ ] Verification output is real (re-run if suspicious)
- [ ] No backward-incompat surprises
- [ ] Tests cover the new behavior
- [ ] Approved