Repository navigation
Reset sound processing state after seeking. - #1196
Closed
zhouyunding wants to merge 1 commit into
Closed
zhouyunding wants to merge 1 commit into
zhouyunding wants to merge 1 commit into
Conversation
Owner
|
Thanks. This has been fixed manually. |
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.
Refs #1186.
Seeking leaves
ma_soundplaying stale audio from the pre-seek position when the source needs resampling:ma_data_source_seek_to_pcm_frame()only moves the data source cursor, while the sound node's read-ahead cache (processingCacheFramesRemaining) and resampler history still hold pre-seek state.This clears both on a successful seek (
MA_SUCCESS/MA_BUSY/MA_AT_END) in the engine's sound node layer, where that state lives. A rejected seek leaves the cache untouched — the fix suggested in the issue lacks this guard.Measured 47/512 stale frames before the fix and 1/512 after (the remainder is resampler warm-up). Rejected seeks (
INVALID_ARGS/NOT_IMPLEMENTED/INVALID_OPERATION) behave as before.Pre-existing, not changed by this PR: with mismatched period/chunk sizes, 129/480 frames still come through stale (base: 311/480); seeking the underlying data source directly when
base == headstill leaves 454/512 stale.Developed with AI assistance.