From e48dd5cdb735eb0ff3ee9b6ae6415b7ff1f47fb9 Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Sat, 6 Jul 2024 18:28:15 +0200 Subject: [PATCH] FIX(client, plugins): Wrong sample count in plugin callback In the mumble_onAudioInput callback that plugins can use, the sampleCount parameter was actually wrong for all cases in which the input had more than a single channel. Instead of the sample count per channel, the total sample count (across all channels) was passed along. Fixes #6464 --- src/mumble/AudioInput.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mumble/AudioInput.cpp b/src/mumble/AudioInput.cpp index 3187704d1..0bb0337cd 100644 --- a/src/mumble/AudioInput.cpp +++ b/src/mumble/AudioInput.cpp @@ -1092,7 +1092,9 @@ void AudioInput::encodeAudioFrame(AudioChunk chunk) { EncodingOutputBuffer buffer; Q_ASSERT(buffer.size() >= static_cast< size_t >(iAudioQuality / 100 * iAudioFrames / 8)); - emit audioInputEncountered(psSource, iFrameSize, iMicChannels, SAMPLE_RATE, bIsSpeech); + assert(iFrameSize % iMicChannels == 0); + const unsigned int samplesPerChannel = iFrameSize / iMicChannels; + emit audioInputEncountered(psSource, samplesPerChannel, iMicChannels, SAMPLE_RATE, bIsSpeech); int len = 0;