59 lines
2.7 KiB
Markdown
59 lines
2.7 KiB
Markdown
# 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 2–5 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
|