Repository navigation
MBEDecoder: initialise m_autoGain (fixes #2) - #3
Merged
Merged
Conversation
m_autoGain was left uninitialised, so a decoder allocated in reused heap memory could take the auto-gain path in decode() and come out about six times too loud. Start it as false, matching the fixed gain (m_gainAdjust) that decoders get when the memory happens to be zero. Fixes DVMProject#2
monkey1911
added a commit
to monkey1911/Sidetone
that referenced
this pull request
Nov 21, 2026
…er#3 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
monkey1911
added a commit
to monkey1911/Sidetone
that referenced
this pull request
Nov 21, 2026
… submodule to e7ab96e, Sidetone's patch dropped Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 #2.
MBEDecoder's constructor didn't initialisem_autoGain, so its value came from whatever was in the heap memory. When it was non-zero,decode()took the auto-gain path and speech decoded at about 6x the expected level.This sets it to
falsein the initialiser list (afterm_gainAdjust, matching the declaration order inMBEDecoder.h). That's the behaviour decoders already had whenever the memory happened to be zero, so nothing changes for callers who weren't hit by the bug.Tested on Linux x86-64 and ARM64: with the change, 0 of 30 decoders made in reused memory and 0 of 80 made on two threads at once decoded at the wrong level (28 of 30 and 12-14 of 80 without it).