Repository navigation
web: LoadMode.disk streams the compressed data instead of decoding it whole - #635
Merged
Merged
Conversation
On the web, loadMem and loadAsset ignored LoadMode.disk: every load went through _loadMemWeb's preserved buffer stream, which keeps every decoded sample, and Player::loadMem forced a Wav under __WEB__. A 90 s stereo Ogg (1 MB) became about 30 MB of samples in the wasm heap. Now a disk-mode load on the web goes to the wasm loadMem, and the player keeps the compressed bytes in a WavStream that decodes as it plays, as on the other platforms. Memory-mode loads are unchanged. The web binaries need a rebuild for the change to take effect.
- m4a/mp4, aac and ac-3 loaded with LoadMode.disk on the web go through the web loader as before: the engine has no decoder for them there - remove the __WEB__ macro, no longer used - tests for the disk streams on the web; repeatEvery refuses them there too - changelog, dartdoc and skills for LoadMode.disk on the web
1 of 7 tasks
This was referenced Dec 4, 2026
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
Supersedes #633 by @18thletter, whose commit is the first one here. The branch of #633 is in a fork owned by an organization, which maintainers cannot push to, so the additions are in this PR.
The change of #633
LoadMode.diskwas ignored: every load was decoded whole into a preserved buffer stream, likeLoadMode.memory. A 90 s stereo Ogg of 1 MB took about 30 MB of the WASM heap.loadMem, and the sound keeps its compressed bytes in aWavStreamthat each voice decodes while it plays, as on the other platforms.Added on top
LoadMode.diskkeep the web loader (the browser's decoder). The engine has no decoder for them on the web, so with the change alone they failed to load, also throughplaySource, which usesdiskby default.__WEB__macro inplayer.cppis removed: nothing uses it any more.loadMemandLoadMode.disk, and theloadingandidiomsskills.Behaviour change
A sound loaded with
LoadMode.diskon the web takes far less memory and loads faster. Each of its voices decodes in the audio callback, which is the main thread unless the page is cross-origin isolated. Seeking an MP3 lags and the sound cannot repeat withrepeatEvery, as on the other platforms.LoadMode.memorybehaves as before.Added new tests.
Type of Change