Files
wz-phone/vault/Reports/T5.3-report.md
Siavash Sameni ed8a7ae5aa 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>
2026-05-25 06:00:17 +04:00

65 lines
2.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
tags: [report, wzp]
type: report
status: Approved
---
# T5.3 — `EncoderMode::SlideFallback` for ScreenShare
**Status:** Approved
**Agent:** Kimi Code CLI
**Started:** 2026-05-12T18:00Z
**Completed:** 2026-05-12T18:10Z
**Commit:** c48cb6f
**PRD:** ../PRD-video-quality-priority.md
## What I changed
- `crates/wzp-video/src/encoder_mode.rs` — New file. `EncoderMode` enum with `Normal` (default) and `SlideFallback` variants.
- `crates/wzp-video/src/lib.rs:11,18` — Added `pub mod encoder_mode;` and re-exported `EncoderMode`.
- `crates/wzp-video/src/encoder.rs:47-50` — Added `set_mode(&mut self, mode: EncoderMode)` default no-op method to `VideoEncoder` trait. Platform encoders override when slide-mode reconfiguration is implemented.
- `crates/wzp-video/src/controller.rs:113-115` — Added `SD_VIDEO_FLOOR_KBPS = 150` constant.
- `crates/wzp-video/src/controller.rs:164-180` — Added `encoder_mode()` method: returns `SlideFallback` when `PriorityMode::ScreenShare` + video budget < 150 kbps, otherwise `Normal`.
- `crates/wzp-video/src/controller.rs:420-442` — Added 3 tests: screenshare-above-floor-normal, screenshare-below-floor-slide, non-screenshare-never-slide.
## Deviations from the task spec
Skeleton task. Followed PRD "ScreenShare slide-fallback" section. The actual hardware-encoder slide-mode implementation (configuring VTCompressionSession / AMediaCodec to emit one I-frame every 25 s) is deferred — the trait method is a no-op default so existing encoders don't break.
## Verification output
```bash
$ cargo test -p wzp-video --lib
test result: ok. 43 passed; 0 failed; 0 ignored
```
```bash
$ cargo build -p wzp-video -p wzp-proto -p wzp-relay -p wzp-client -p wzp-android -p wzp-codec -p wzp-desktop
# Finished successfully
```
```bash
$ cargo fmt --all -- --check
# pass
```
## Test summary
- Tests added: 3 (`screenshare_above_floor_is_normal`, `screenshare_below_floor_is_slide_fallback`, `non_screenshare_never_slide_fallback`)
- Tests modified: 0
- `cargo clippy -p wzp-video --all-targets -- -D warnings`: pass
- `cargo fmt --all -- --check`: pass
## Risks / follow-ups
1. **Hardware encoder slide mode not implemented** — VideoToolbox and MediaCodec `set_mode()` are no-ops. Real implementation needs platform-specific code to set `kVTEncodeFrameRate` / `KEY_FRAME_RATE` to ~0.33 fps and force every frame as keyframe.
2. **Caller not yet wiring `encoder_mode()`** — The engine code that calls `VideoQualityController::tick()` also needs to call `encoder_mode()` and pass the result to `encoder.set_mode()`.
## Reviewer checklist (filled in by reviewer)
- [ ] Code matches PRD intent
- [ ] Verification output is real
- [ ] No backward-incompat surprises
- [ ] Tests cover the new behavior
- [ ] Approved