Bugfix-#2383-audio-trapped-in-output-buffer-of-resampler (#2384)

Closes #2383

Resolves issue with audio samples trapped in the resampler output buffer. Includes improvement provided by @bazineta
This commit is contained in:
Randy
2026-07-11 03:27:15 -06:00
committed by GitHub
parent 788d994ad7
commit ccae1d05e7
3 changed files with 64 additions and 13 deletions

View File

@@ -84,8 +84,18 @@ public class NBFMDecoder extends SquelchControlDecoder implements ISourceEventLi
//Send squelch controlled audio to the resampler and notify the decoder state that the call continues.
mNoiseSquelch.setAudioListener(audio -> {
mResampler.resample(audio);
notifyCallContinuation();
// if squelch is closing (it hasn't propagated yet to mute the audio)
// call the resampler with lastBatch set to true. This will zero pad the input buffer and ensure
// the output buffer gets emptied.
if(mNoiseSquelch.isSquelched())
{
mResampler.resample(audio, true);
}
else
{
mResampler.resample(audio); // this method will set lastBatch to false
notifyCallContinuation();
}
});
//Notify the decoder state of call starts and ends