Skip to content
Permalink
Browse files

Fix sequence counter becoming invalid for end-of-speech frames.

  • Loading branch information...
hacst committed Nov 4, 2014
1 parent ef6353b commit 268298723269a78e02c03c9521b786a3d6a37d63
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/mumble/AudioInput.cpp
@@ -868,10 +868,16 @@ void AudioInput::encodeAudioFrame() {
if (!bIsSpeech || iBufferedFrames >= iAudioFrames) {
if (iBufferedFrames < iAudioFrames) {
// Stuff frame to framesize if speech ends and we don't have enough audio
// this way we are guaranteed to have a valid framecount and won't cause
// a codec configuration switch by suddenly using a wildly different
// framecount per packet.
const size_t missingFrames = iAudioFrames - iBufferedFrames;
opusBuffer.insert(opusBuffer.end(), iFrameSize * missingFrames, 0);
iBufferedFrames += missingFrames;
iFrameCounter += missingFrames;
}

Q_ASSERT(iBufferedFrames == iAudioFrames);

len = encodeOpusFrame(&opusBuffer[0], iBufferedFrames * iFrameSize, buffer);
opusBuffer.clear();

0 comments on commit 2682987

Please sign in to comment.
You can’t perform that action at this time.