Bug 979716: Make Opus complexity configurable in WebRTC; default Gonk to complexity 1 r=jmspeex

This commit is contained in:
Randell Jesup 2014-07-01 05:10:44 -04:00
parent 5049f76b90
commit a7c962bbd9
3 changed files with 10 additions and 0 deletions

View File

@ -65,6 +65,7 @@ elif os == 'Android':
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
gyp_vars['build_with_gonk'] = 1
gyp_vars['moz_widget_toolkit_gonk'] = 1
gyp_vars['opus_complexity'] = 1
if int(CONFIG['ANDROID_VERSION']) >= 18:
gyp_vars['moz_webrtc_omx'] = 1
else:

View File

@ -7,6 +7,9 @@
# be found in the AUTHORS file in the root of the source tree.
{
'variables': {
'opus_complexity%': 0,
},
'targets': [
{
'target_name': 'webrtc_opus',
@ -26,6 +29,9 @@
'include_dirs': [
'<(webrtc_root)',
],
'defines': [
'OPUS_COMPLEXITY=<(opus_complexity)'
],
'sources': [
'interface/opus_interface.h',
'opus_interface.c',

View File

@ -103,6 +103,9 @@ int16_t WebRtcOpus_Encode(OpusEncInst* inst, int16_t* audio_in, int16_t samples,
int16_t WebRtcOpus_SetBitRate(OpusEncInst* inst, int32_t rate) {
if (inst) {
#if defined(OPUS_COMPLEXITY) && (OPUS_COMPLEXITY != 0)
opus_encoder_ctl(inst->encoder, OPUS_SET_COMPLEXITY(OPUS_COMPLEXITY));
#endif
return opus_encoder_ctl(inst->encoder, OPUS_SET_BITRATE(rate));
} else {
return -1;