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>2013-09-17 04:09:23 +0400
committerMikkel Krautz <mikkel@krautz.dk>2013-09-17 04:09:23 +0400
commita068929ec27d8da99edbe29e6239d25f81721a72 (patch)
tree36a79b0c44c6d8db51cbf986d02b01980f5a8dac
parentfcf0beb8f18dae8525aedad77bccb53a09247905 (diff)
MKAudio, MKAudioInput: add a setting to force CELT mode when using Opus.
-rw-r--r--src/MKAudioInput.m9
-rw-r--r--src/MumbleKit/MKAudio.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/src/MKAudioInput.m b/src/MKAudioInput.m
index bfcf6ce..ea1db33 100644
--- a/src/MKAudioInput.m
+++ b/src/MKAudioInput.m
@@ -345,6 +345,15 @@
if (!_lastTransmit) {
opus_encoder_ctl(_opusEncoder, OPUS_RESET_STATE, NULL);
}
+
+ // Force CELT mode when using Opus if we were asked to.
+ if (_settings.opusForceCELTMode) {
+#define OPUS_SET_FORCE_MODE_REQUEST 11002
+#define OPUS_SET_FORCE_MODE(x) OPUS_SET_FORCE_MODE_REQUEST, __opus_check_int(x)
+#define MODE_CELT_ONLY 1002
+ opus_encoder_ctl(_opusEncoder, OPUS_SET_FORCE_MODE(MODE_CELT_ONLY));
+ }
+
opus_encoder_ctl(_opusEncoder, OPUS_SET_BITRATE(_settings.quality));
len = opus_encode(_opusEncoder, (short *) [_opusBuffer bytes], _bufferedFrames * frameSize, encbuf, max);
[_opusBuffer setLength:0];
diff --git a/src/MumbleKit/MKAudio.h b/src/MumbleKit/MKAudio.h
index ae84eec..1f8fd42 100644
--- a/src/MumbleKit/MKAudio.h
+++ b/src/MumbleKit/MKAudio.h
@@ -56,6 +56,7 @@ typedef struct _MKAudioSettings {
double vadGateTimeSeconds;
BOOL preferReceiverOverSpeaker;
+ BOOL opusForceCELTMode;
} MKAudioSettings;
/// @protocol MKAudioDelegate MKAudio.h MumbleKit/MKAudio.h