Skip to content

fix: converge physical-output presentation size negotiation - #25

Open
maryny4 wants to merge 1 commit into
MuNeNiCK:mainfrom
maryny4:fix/presentation-size-convergence
Open

fix: converge physical-output presentation size negotiation#25
maryny4 wants to merge 1 commit into
MuNeNiCK:mainfrom
maryny4:fix/presentation-size-convergence

Conversation

@maryny4

@maryny4 maryny4 commented Aug 6, 2026

Copy link
Copy Markdown

Problem

When capturing a physical output, the requested presentation size is reshaped to the exact source aspect plus even-dimension rounding. mstsc answers every applied size it did not ask for with another resize request, which gets reshaped again: the negotiation walks a shrinking staircase — observed live as 728x408 → 724x408 → 724x406 → … → 704x396 — with a full capture and encoder restart on every step (17+ encoder generations in one connection), visible as white flashes and a window that keeps shrinking on its own, until the pair happens to land on a size that is both even and exactly source-aspect.

Fix

Keep the requested size, clamped only to the H.264 policy limits and even dimensions — both idempotent, so the client's echo of the applied size terminates the negotiation in one round trip. Aspect mismatches are letterboxed by the presentation scaler, which (together with damage mapping and pointer mapping) already handles fallback bars.

A regression test drives the observed staircase input through initial_size_resize_decision and asserts the echoed size produces no further resize decision.

cargo fmt --check, clippy -- -D warnings, cargo test (both feature sets) pass. Verified live: a windowed client at an arbitrary non-16:9 size settles immediately with bars instead of walking the staircase.

Reshaping the client's requested presentation size to the exact source
aspect re-announces a size the client did not ask for. mstsc answers
with another resize request for the announced size, which gets reshaped
again: the negotiation walks a shrinking even/aspect staircase
(728x408 -> 724x408 -> 724x406 -> ... -> 704x396) with a full capture
and encoder restart on every step until it happens to land on a pair
that is both even and exactly source-aspect.

Keep the requested size (clamped to H.264 policy limits and even
dimensions, both idempotent) and let the presentation scaler letterbox
the aspect mismatch — the scaler, damage mapping and pointer mapping
already handle fallback bars.

(cherry picked from commit 9f71acf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant