diff --git a/engine/audio/private/voice.cpp b/engine/audio/private/voice.cpp index 1948766b..944c02ac 100644 --- a/engine/audio/private/voice.cpp +++ b/engine/audio/private/voice.cpp @@ -671,7 +671,7 @@ bool Voice_Init( const char *pCodecName, int nSampleRate ) // // Changing the quality level we use here will require either extending SVC_VoiceInit to pass down which quality is // in use or using a different codec name (vaudio_celtHD!) for backwards compatibility - int quality = bCelt ? 3 : 4; + int quality = ( bCelt || bOpus ) ? 3 : 4; // Get the codec. CreateInterfaceFn createCodecFn = NULL; diff --git a/engine/voice_codecs/opus/voiceencoder_opus.cpp b/engine/voice_codecs/opus/voiceencoder_opus.cpp index 203539bc..6fa4e9b6 100644 --- a/engine/voice_codecs/opus/voiceencoder_opus.cpp +++ b/engine/voice_codecs/opus/voiceencoder_opus.cpp @@ -97,6 +97,11 @@ bool VoiceEncoder_Opus::Init( int quality, int &rawFrameSize, int &encodedFrameS m_Mode = opus_custom_mode_create( g_OpusOpts[m_iVersion].iSampleRate, g_OpusOpts[m_iVersion].iRawFrameSize, &iError ); + if ( iError != 0 ) { + Msg( "Opus init failed with error %d", iError ); + return false; + } + m_EncoderState = opus_custom_encoder_create( m_Mode, CHANNELS, NULL); m_DecoderState = opus_custom_decoder_create( m_Mode, CHANNELS, NULL); diff --git a/lib b/lib index 7ec9e138..b3fe8769 160000 --- a/lib +++ b/lib @@ -1 +1 @@ -Subproject commit 7ec9e1386e7c14539ce09cf27bf8903368afaaed +Subproject commit b3fe8769dbcb1b6cf991b2612c23f55b68c7ac4e diff --git a/wscript b/wscript index dd6bbd46..dbaaed02 100644 --- a/wscript +++ b/wscript @@ -138,6 +138,7 @@ def define_platform(conf): conf.env.DEDICATED = conf.options.DEDICATED conf.env.TOGLES = conf.options.TOGLES conf.env.GL = conf.options.GL + conf.env.OPUS = conf.options.OPUS if conf.options.DEDICATED: conf.options.SDL = False @@ -507,6 +508,9 @@ def build(bld): projects['game'] += ['utils/bzip2'] projects['dedicated'] += ['utils/bzip2'] + if bld.env.OPUS or bld.env.DEST_OS == 'android': + projects['game'] += ['engine/voice_codecs/opus'] + if bld.env.DEDICATED: bld.add_subproject(projects['dedicated']) else: