T5.1: PriorityMode enum + SetPriorityMode signal; extend QualityProfile with video fields
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# T4.7 — PLI suppression at SFU
|
||||
|
||||
**Status:** Changes Requested — substantive review in chat (per the reviewer-notes policy change from T4.6)
|
||||
**Status:** Approved (rework done by reviewer)
|
||||
**Agent:** Kimi Code CLI
|
||||
**Started:** 2026-05-12T16:40Z
|
||||
**Completed:** 2026-05-12T17:00Z
|
||||
@@ -50,14 +50,57 @@ $ cargo fmt --all -- --check
|
||||
|
||||
## Risks / follow-ups
|
||||
|
||||
1. **Per-sender forwarding** — Currently PLI is broadcast to all other participants. When stream→sender mapping is available, forward to the specific sender only.
|
||||
2. **No unit test** — The 200 ms window is time-dependent. An integration test with mocked `Instant` or `tokio::time::pause` could be added later.
|
||||
1. **Per-sender forwarding** — Currently PLI is broadcast to all other participants. When stream→sender mapping is available, forward to the specific sender only. *(Addressed in commit `36b0421`: `should_forward_pli` now returns `Option<ParticipantId>` by consulting `stream_owner`.)*
|
||||
2. **No unit test** — *(Addressed in rework commit `001d94f`: see Rework section below.)*
|
||||
3. **Signal loop is new** — Room mode previously had no signal handling. Other signal variants (`Nack`, etc.) are currently ignored; they can be wired here as needed.
|
||||
|
||||
## Rework — 2026-05-12 (done by reviewer, since the rework was above the agent's effective scope)
|
||||
|
||||
Commit `001d94f` addresses the two CR asks the agent's `36b0421` did not:
|
||||
|
||||
**Refactor:** `should_forward_pli(room, stream_id)` → `should_forward_pli(room, stream_id, now: Instant)`. The 200 ms dedup window now consumes a caller-provided `Instant`. The one production caller (`run_participant_signals` at `room.rs:919`) passes `std::time::Instant::now()`. Uses `now.saturating_duration_since(entry.last_pli)` so test code feeding monotonic-but-not-real-clock instants is safe.
|
||||
|
||||
**6 new unit tests** in `crates/wzp-relay/src/room.rs`:
|
||||
- `pli_first_forwards` — initial PLI returns `Some(owner)`.
|
||||
- `pli_within_window_suppressed` — second PLI at `t0 + 100 ms` returns `None`.
|
||||
- `pli_after_window_forwards` — second PLI at `t0 + 300 ms` returns `Some(owner)` again.
|
||||
- `pli_different_streams_independent` — PLIs on `stream_id=0` and `stream_id=1` in the same room and same instant both forward.
|
||||
- `pli_different_rooms_independent` — PLIs in `room-a` and `room-b` at the same instant both forward.
|
||||
- `pli_no_owner_returns_none` — PLI for a stream with no `stream_owner` entry returns `None` (the new short-circuit from `36b0421`).
|
||||
|
||||
Test helper `seed_stream_owner(mgr, room, stream_id, owner)` directly inserts into `RoomManager::stream_owner` for fixture setup.
|
||||
|
||||
Verification:
|
||||
|
||||
```
|
||||
$ cargo test -p wzp-relay --lib pli
|
||||
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 93 filtered out
|
||||
|
||||
$ cargo test -p wzp-relay --lib
|
||||
test result: ok. 99 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
|
||||
|
||||
$ cargo clippy -p wzp-relay --all-targets -- -D warnings
|
||||
clean
|
||||
|
||||
$ cargo fmt --all -- --check
|
||||
clean
|
||||
```
|
||||
|
||||
wzp-relay lib tests: 93 → 99 (+6 PLI).
|
||||
|
||||
## Reviewer checklist (filled in by reviewer)
|
||||
|
||||
- [ ] Code matches PRD intent
|
||||
- [ ] Verification output is real
|
||||
- [ ] No backward-incompat surprises
|
||||
- [ ] Tests cover the new behavior
|
||||
- [ ] Approved
|
||||
- [x] Code matches PRD intent — PLI dedup window per `(room, sender, stream_id)`, 200 ms, with per-sender forwarding via `stream_owner` map
|
||||
- [x] Verification output is real — re-ran `cargo test -p wzp-relay --lib pli` (6 pass) + full `cargo test -p wzp-relay --lib` (99 pass); clippy + fmt clean
|
||||
- [x] No backward-incompat surprises — `should_forward_pli` signature changed, only one production caller, updated
|
||||
- [x] Tests cover the new behavior — 6 unit tests covering the dedup window from both sides + cross-stream / cross-room independence + missing-owner
|
||||
- [x] Approved
|
||||
|
||||
### Reviewer notes (chat-authoritative, per the policy from T4.6)
|
||||
|
||||
The rework was done by me (the reviewer) rather than the agent because, as you put it, "above the agent's paygrade" — they shipped two iterations of T4.7 without ever doing the testability refactor I asked for, despite it being a 30-minute change. Approved at commit `001d94f`.
|
||||
|
||||
Two structural fixes I made beyond the strict CR ask:
|
||||
|
||||
- Used `now.saturating_duration_since(entry.last_pli)` instead of `.elapsed()` — the latter calls `Instant::now()` internally and would defeat the testability refactor. Subtle but necessary.
|
||||
- Added a 6th test (`pli_no_owner_returns_none`) for the early-return path the agent introduced in `36b0421`. The agent introduced the code path; I wrote the test for it.
|
||||
|
||||
Reference in New Issue
Block a user