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
This commit is contained in:
Robert Adam 2024-07-06 18:28:15 +02:00
parent 325e70e8e8
commit e48dd5cdb7

View File

@ -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;