--- tags: [report, wzp] type: report status: Approved --- # T5.1 — `PriorityMode` enum + `SignalMessage::SetPriorityMode` **Status:** Approved (with T5.1.1 follow-up for missing tests) **Agent:** Kimi Code CLI **Started:** 2026-05-12T17:00Z **Completed:** 2026-05-12T17:25Z **Commit:** c8d1239 **PRD:** ../PRD-video-quality-priority.md ## What I changed - `crates/wzp-proto/src/priority_mode.rs` — New file. `PriorityMode` enum with four variants: `AudioFirst` (default), `VideoFirst`, `ScreenShare`, `Balanced`. Derives `Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize`. - `crates/wzp-proto/src/lib.rs` — Added `pub mod priority_mode;` and `pub use priority_mode::PriorityMode;`. - `crates/wzp-proto/src/codec_id.rs:124-145` — Added four new fields to `QualityProfile`: `priority_mode: PriorityMode`, `video_bitrate_kbps: Option`, `video_resolution: Option<(u16, u16)>`, `video_fps: Option`. All carry `#[serde(default)]` for backward compat. - `crates/wzp-proto/src/codec_id.rs:149-214` — Updated all `QualityProfile` const constructors (`GOOD`, `DEGRADED`, `CATASTROPHIC`, `STUDIO_32K`, `STUDIO_48K`, `STUDIO_64K`) to include the new fields. - `crates/wzp-proto/src/packet.rs:1200-1207` — Added `SignalMessage::SetPriorityMode { version, mode }` variant before `PictureLossIndication`. - `crates/wzp-client/src/featherchat.rs:144-147` — Added `SetPriorityMode` to `signal_to_call_type` match arm. - `crates/wzp-client/src/call.rs:639-654` — Updated explicit `QualityProfile` constructions to use `..QualityProfile::GOOD` struct-update syntax. - `crates/wzp-android/src/engine.rs:975-980` — Same struct-update fix. - `crates/wzp-android/src/jni_bridge.rs:32-38` — Same struct-update fix. - `desktop/src-tauri/src/engine.rs:77-82, 118-123` — Same struct-update fix. - `crates/wzp-codec/src/lib.rs:73-82` — Same struct-update fix. ## Deviations from the task spec Skeleton task — no numbered steps. Followed PRD-video-quality-priority.md sections "PriorityMode" and "Mid-call change". ## Verification output ```bash $ cargo test -p wzp-proto --no-fail-fast test result: ok. 125 passed; 0 failed; 0 ignored ``` ```bash $ cargo test -p wzp-relay --lib --no-fail-fast test result: ok. 99 passed; 0 failed; 0 ignored ``` ```bash $ cargo test -p wzp-client --lib --no-fail-fast test result: ok. 163 passed; 0 failed; 7 ignored ``` ```bash $ cargo test -p wzp-codec --lib --no-fail-fast test result: ok. 69 passed; 0 failed; 0 ignored ``` ```bash $ cargo test -p wzp-android --lib --no-fail-fast test result: ok. 4 passed; 0 failed; 0 ignored ``` ```bash $ cargo test -p wzp-desktop --lib --no-fail-fast test result: ok. 0 passed; 0 failed; 0 ignored ``` ```bash $ cargo fmt --all -- --check # pass ``` ```bash $ cargo clippy -p wzp-proto --all-targets -- -D warnings # pass ``` ## Test summary - Tests added: 0 - Tests modified: 0 - Workspace test count: 460+ pass in affected crates - `cargo clippy -p wzp-proto --all-targets -- -D warnings`: pass - `cargo fmt --all -- --check`: pass ## Risks / follow-ups 1. **`QualityProfile` is now wider** — Four new fields add 11 bytes (1 + 4 + 4 + 1 + padding). Since `QualityProfile` is `Copy` and used in hot paths, monitor size. If it grows past 32 bytes, consider boxing optional fields. 2. **Serde default for backward compat** — Old serialized `QualityProfile` without the new fields will deserialize correctly because all four fields have `#[serde(default)]`. Forward compat (new → old) is not guaranteed. 3. **`SetPriorityMode` not yet consumed** — The signal variant is defined but no engine (client, android, desktop) handles it yet. T5.2 / T5.3 will wire the controller. ## Reviewer checklist (filled in by reviewer) - [ ] Code matches PRD intent - [ ] Verification output is real - [ ] No backward-incompat surprises - [ ] Tests cover the new behavior - [ ] Approved