Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumblekit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikkel Krautz <mikkel@krautz.dk>2014-01-26 17:24:42 +0400
committerMikkel Krautz <mikkel@krautz.dk>2014-01-26 17:26:44 +0400
commit39b28a082ddc02d0c336fff31590960106085a4c (patch)
tree536cf3b93fe3df8763478bc2311e64c453bc8096
parentb4fc65750d13866b7723286d81c9aba8aeb0bf5e (diff)
MKAudioInput: increase size of the encode output buffer to 960 bytes.
Like we did for desktop Mumble in 5fa918be84cdcc218b7e2def33438f8ccbb9dd04. "With Opus frames are no longer limited to a duration of 10ms like with CELT. This means a single frame can now become bigger than previously possible. At our maximum supported rate of 96kbit/s with 60ms frames a single frame will be 720 bytes. Previously the encoding output buffer was 512 bytes which triggered rate limiting in Opus to hit this goal."
-rw-r--r--src/MKAudioInput.m9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/MKAudioInput.m b/src/MKAudioInput.m
index ea1db33..d2b6ad7 100644
--- a/src/MKAudioInput.m
+++ b/src/MKAudioInput.m
@@ -72,6 +72,7 @@
double _vadGateTimeSeconds;
double _vadOpenLastTime;
+ NSMutableData *_encodingOutputBuffer;
NSMutableData *_opusBuffer;
MKConnection *_connection;
@@ -179,6 +180,7 @@
[frameList release];
[_opusBuffer release];
+ [_encodingOutputBuffer release];
if (psMic)
free(psMic);
@@ -534,10 +536,11 @@
return;
}
- unsigned char buffer[500];
- int len = [self encodeAudioFrameOfSpeech:_doTransmit intoBuffer:&buffer[0] ofSize:500];
+ if (_encodingOutputBuffer == nil)
+ _encodingOutputBuffer = [[NSMutableData alloc] initWithLength:960];
+ int len = [self encodeAudioFrameOfSpeech:_doTransmit intoBuffer:[_encodingOutputBuffer mutableBytes] ofSize:[_encodingOutputBuffer length]];
if (len >= 0) {
- NSData *outputBuffer = [[NSData alloc] initWithBytes:buffer length:len];
+ NSData *outputBuffer = [[NSData alloc] initWithBytes:[_encodingOutputBuffer bytes] length:len];
[self flushCheck:outputBuffer terminator:!_doTransmit];
[outputBuffer release];
}