fix: converge physical-output presentation size negotiation - #25
Open
maryny4 wants to merge 1 commit into
Open
Conversation
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_decisionand 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.