feat: account for display pixel density in adaptive stream#1098
Draft
hiroshihorie wants to merge 7 commits into
Draft
feat: account for display pixel density in adaptive stream#1098hiroshihorie wants to merge 7 commits into
hiroshihorie wants to merge 7 commits into
Conversation
1fdd82b to
86a4ee3
Compare
The adaptive-stream visibility observer fed each view's logical (DIP) size straight to the server, so on retina/HiDPI displays it under-requested by the device pixel ratio and the server returned an upscaled/soft layer. Server layers are sized in physical pixels. - Add AdaptiveStreamPixelDensity (auto | fixed(double)) capped at 3x, mirroring the JS pixelDensity option. - Add a per-view VideoTrackRenderer.adaptiveStreamPixelDensity (default auto); the density is stored per view-key on the track. - _computeVideoViewVisibility scales each view's logical size by its own resolved density (auto = that view's MediaQuery devicePixelRatio) before taking the largest size across the track's views. Because density is resolved per view, a track shown on screens with different scales (e.g. built-in retina + external 1x) requests correctly for each.
86a4ee3 to
a4c0dbe
Compare
xianshijing-lk
requested changes
May 29, 2026
|
|
||
| @internal | ||
| void updateViewKeyPixelDensity(GlobalKey key, AdaptiveStreamPixelDensity pixelDensity) { | ||
| if (viewPixelDensities.containsKey(key)) viewPixelDensities[key] = pixelDensity; |
Contributor
There was a problem hiding this comment.
should we log or handle the case where if (!viewPixelDensities.containsKey(key)) ?
xianshijing-lk
approved these changes
May 29, 2026
Contributor
xianshijing-lk
left a comment
There was a problem hiding this comment.
one question, lgtm in general
…tion The map().nonNulls iterable was lazy and consumed three times per 300ms visibility tick (length, isNotEmpty, reduce), re-running findRenderObject and MediaQuery lookups on each pass. Materialize once with toList().
Use MediaQuery.maybeDevicePixelRatioOf instead of maybeOf(context)?.devicePixelRatio so the view depends only on the pixel ratio rather than every MediaQuery field (padding, text scale, etc.).
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.
The adaptive-stream visibility observer fed each view's logical (DIP) size straight to the server, so on retina/HiDPI displays it under-requested by the device pixel ratio and the server returned an upscaled/soft layer. Server layers are sized in physical pixels.