Repository navigation
fix: keep the quality governor from degrading decoder-bound and new videos - #283
Merged
Merged
Conversation
Dropped video frames lowered the quality level even when GPU time and compositor pacing were well inside budget. On Quest 3 an 8192x4096 HEVC Main 10 file at ~122 Mbps decoded at ~47 of 60 fps with the GPU at ~1.9 ms per frame; the governor fell from HIGH to EMERGENCY in 6 s, cutting render scale to 0.7 and refresh to 72 Hz without helping the decoder. Drops now count as render stress only when render is not healthy, and no longer block recovery once it is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DKhrqTrv7b11FgaPF1e7FV
The quality controller is process-global and kept the level earned by the previous file. After a decoder-bound 8K clip a 4320x2160 clip started in EMERGENCY (72 Hz, render scale 0.7) and needed ~58 s of 30-sample recovery steps to reach MEDIUM. Every playback entry point now resets the level, reason and stress counters, unless adaptive mode is off and the level is the user's choice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DKhrqTrv7b11FgaPF1e7FV
…twork sources Only local and HTTP playback told the quality controller the video's frame rate, so refresh-rate cadence matching never ran for SMB, FTP, SFTP, NFS or WebDAV files. All six playback entry points now set it after a successful load and clear it on failure, through one helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DKhrqTrv7b11FgaPF1e7FV
The decoder was configured with realtime priority but without KEY_FRAME_RATE or KEY_OPERATING_RATE, which MediaFormat documents as the rate a realtime codec plans its resources for. Both are now set from the stream's average frame rate when the container declares it. On Quest 3 with an 8192x4096 HEVC Main 10 file at ~122 Mbps, one ~2-minute run each: late-dropped frames went from 3.85 to 2.40 per second on average (p95 10.9 -> 8.0) and decoded fps from 56.1 to 57.1. The stream still does not hold a steady 60 fps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DKhrqTrv7b11FgaPF1e7FV
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.
Description
Three plays of the same SLR clip at different bitrates on Quest 3 (HEVC Main 10, 59.94 fps, streamed over SFTP) showed the adaptive quality governor making playback worse, not better:
4096p_original2160p4096pFour fixes, one commit each:
rust/media-logic/src/quality.rs). Dropped video frames counted as render stress even with GPU time at ~1.9 ms of an 11.1 ms frame. Lowering render scale or refresh rate cannot help a decoder that cannot keep up with the bitrate. Drops now count only when GPU time or compositor pacing is outside its healthy budget, and they no longer block recovery once render is healthy.QualityController::reset_for_new_content, called from all six playback entry points inrust/bridge/src/lib.rs). The controller is process-global; the next file kept the previous file's level and needed ~30 s per level to recover. With adaptive mode off, the user's level is kept.rust/bridge/src/lib.rs). Only local/HTTP playback calledset_content_fps, so refresh-rate cadence matching never ran for SMB, FTP, SFTP, NFS or WebDAV. All six paths now go through one helper.rust/core/src/playback.rs). It was configured withpriority=0but withoutframe-rate/operating-rate, whichMediaFormatdocuments as the rate a realtime codec plans its resources for.Type of change
Affected layers
app/) — app shell, UI panels, credentials, history, i18nnative/) — OpenXR session, Vulkan/GLES render loop, controller inputrust/) — demux, decode, audio, network protocolsHow has this been tested?
cargo test)Host:
cargo test -p protocols -p media-logicpasses;cargo fmt --checkandcargo clippy -p protocols -p media-logic --all-targets --all-features -- -D warningsare clean. Four new tests inquality.rsfailed before the fix; two feed the telemetry of the ~122 Mbps session. The three existing dropped-frame tests now use a marginal GPU sample so they still exercise the counter.bridgeandcorewere cross-compiled with./scripts/build-rust.sh(they do not build on the host).Quest 3, after the fixes (telemetry CSV, same files):
2160p4096p4096p_originalFix 4 alone,
4096p_originalover the LAN, one ~2-minute run each: dropped frames 3.85 -> 2.40 per second on average (p95 10.9 -> 8.0), decoded 56.1 -> 57.1 fps. With one run per side this is within what content differences could explain. The ~122 Mbps file still does not hold a steady 60 fps; that looks like the Quest 3 hardware decoder's limit at that bitrate.Not tested: playback speed above 1x (the decoder is told the 1x frame rate), and long sessions under thermal throttling.
Checklist:
clippy -D warnings).If applicable
SCREEN_MODEinrust/bridge/src/lib.rs,enum class ScreenModeinnative/include/screen_mode.h, the catalog inScreenFormatCatalog.kt, andFormat3D::to_screen_mode_indexinrust/media-logic/src/format3d.rs.values/strings.xmland allvalues-*/strings.xml), keeping the key order mirrored and using positional placeholders (%1$s).media-logic(host-testable) rather than incore, where it could not be tested.🤖 Generated with Claude Code
https://claude.ai/code/session_01DKhrqTrv7b11FgaPF1e7FV