diff options
author | Mikkel Krautz <mikkel@krautz.dk> | 2013-09-17 04:09:23 +0400 |
---|---|---|
committer | Mikkel Krautz <mikkel@krautz.dk> | 2013-09-17 04:09:23 +0400 |
commit | a068929ec27d8da99edbe29e6239d25f81721a72 (patch) | |
tree | 36a79b0c44c6d8db51cbf986d02b01980f5a8dac | |
parent | fcf0beb8f18dae8525aedad77bccb53a09247905 (diff) |
MKAudio, MKAudioInput: add a setting to force CELT mode when using Opus.
-rw-r--r-- | src/MKAudioInput.m | 9 | ||||
-rw-r--r-- | src/MumbleKit/MKAudio.h | 1 |
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 |