Repository navigation
fix(stream): fall back by codec when a decoder refuses the stream - #67
Merged
Merged
Conversation
A browser whose isConfigSupported says yes to prefer-hardware while configure fails rebuilt with that same setting twice a second, for good: a black screen. A rebuild now moves past the acceleration that failed before its first frame, down to prefer-software, and a configure that throws instead of calling error reaches the same rebuild. A codec this browser decodes under no acceleration ended the stream even when another codec was on offer. The engine now drops it from the offer and reconnects, once per codec per stream the player starts, and says which codec took over, including when that overrides the codec setting. H.264 can leave the offer too, so a pin on it can fall back. The overlay said WebCodecs whether the frames came from hardware or software. It now names the acceleration once a decoder has produced a frame. Fixes the fallback half of #59.
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.
Fixes the fallback half of #59. The codec selector is already there: the "Video codec" row in Settings (Automatic / HEVC / AV1 / H.264). This PR adds no setting.
The four gaps
isConfigSupportedloops forever. A rebuild now probes only the accelerations after the one that failed before its first frame:prefer-hardware→no-preference→prefer-software. If none is left, the codec is undecodable. A new configuration from the host starts at hardware again. A decoder that has produced frames keeps its acceleration through a later error.decoder.configure()escaped. It is now counted, logged and routed to the same rebuild as theerrorcallback.restartInSdr()drops HDR. A launch notice then says "This browser can't decode HEVC, so the stream uses H.264." It adds ", ignoring the Video codec setting" when the player had pinned the refused codec. Each codec falls back once per stream the player starts, so two failing codecs can't ping-pong. The existing error shows only when no codec is left.pf_session_codecsno longer forces H.264 back in, so a refused H.264 really leaves the offer. An empty mask still offers H.264._pf_video_decoder(accel)is a new export (0 unknown, 1 hardware, 2 software). The page calls it on a decoder's first frame. The overlay then readsWebCodecs, hardware,WebCodecs, software, orWebCodecsforno-preference.Tested
npm test: 88 pass, including newvideo.test.tscases and one newengine.test.tscase:onUndecodablemain.npm run checkis clean.packages/stream:cargo fmt --check,cargo clippy --all-targetsandcargo clippy --target wasm32-unknown-emscripten -- -D warningsare clean,cargo testpasses 21, andbash build.shlinks (the emitted glue exports_pf_video_decoder).