Skip to content

MBEDecoder: initialise m_autoGain (fixes #2) - #3

Merged
gatekeep merged 1 commit into
DVMProject:mainfrom
monkey1911:fix-autogain-init
Nov 21, 2026
Merged

gatekeep merged 1 commit into
DVMProject:mainfrom
monkey1911:fix-autogain-init

Conversation

@monkey1911

Copy link
Copy Markdown
Contributor

Fixes #2.

MBEDecoder's constructor didn't initialise m_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 false in the initialiser list (after m_gainAdjust, matching the declaration order in MBEDecoder.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).

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>
@gatekeep
gatekeep merged commit e7ab96e into DVMProject:main Nov 21, 2026
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>
@monkey1911
monkey1911 deleted the fix-autogain-init branch November 22, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MBEDecoder: m_autoGain is never initialised, so decoded audio is randomly ~6x too loud

2 participants