diff --git a/.classpath b/.classpath
index 2c1efbc34..2df25a2b6 100644
--- a/.classpath
+++ b/.classpath
@@ -7,7 +7,7 @@
-
+
diff --git a/.gitmodules b/.gitmodules
index 409aec546..888c77edd 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -73,3 +73,6 @@
[submodule "submodules/externals/polarssl"]
path = submodules/externals/polarssl
url = git://git.linphone.org/polarssl.git
+[submodule "submodules/externals/opus"]
+ path = submodules/externals/opus
+ url = git://git.opus-codec.org/opus.git
diff --git a/Makefile b/Makefile
index 23ccd3c4b..14a733185 100644
--- a/Makefile
+++ b/Makefile
@@ -21,8 +21,10 @@ BUILD_AMRWB=0
BUILD_GPLV3_ZRTP=0
BUILD_SILK=1
BUILD_G729=0
+BUILD_OPUS=1
BUILD_TUNNEL=0
BUILD_WEBRTC_AECM=1
+BUILD_OPUS=1
BUILD_FOR_X86=1
USE_JAVAH=1
BUILD_TLS=1
@@ -165,7 +167,7 @@ prepare-sources: prepare-ffmpeg prepare-ilbc prepare-vpx prepare-silk prepare-sr
LIBLINPHONE_OPTIONS = NDK_DEBUG=$(NDK_DEBUG) LINPHONE_VERSION=$(LINPHONE_VERSION) BUILD_UPNP=$(BUILD_UPNP) BUILD_REMOTE_PROVISIONING=$(BUILD_REMOTE_PROVISIONING) BUILD_X264=$(BUILD_X264) \
BUILD_AMRNB=$(BUILD_AMRNB) BUILD_AMRWB=$(BUILD_AMRWB) BUILD_GPLV3_ZRTP=$(BUILD_GPLV3_ZRTP) BUILD_SILK=$(BUILD_SILK) BUILD_G729=$(BUILD_G729) BUILD_TUNNEL=$(BUILD_TUNNEL) \
BUILD_WEBRTC_AECM=$(BUILD_WEBRTC_AECM) BUILD_FOR_X86=$(BUILD_FOR_X86) USE_JAVAH=$(USE_JAVAH) BUILD_TLS=$(BUILD_TLS) BUILD_SQLITE=$(BUILD_SQLITE) \
- BELLESIP_VERSION=$(BELLESIP_VERSION)
+ BELLESIP_VERSION=$(BELLESIP_VERSION) BUILD_OPUS=$(BUILD_OPUS)
generate-libs: prepare-sources javah
diff --git a/jni/Android.mk b/jni/Android.mk
index 2ea7ad0d9..f28c5128f 100755
--- a/jni/Android.mk
+++ b/jni/Android.mk
@@ -146,6 +146,10 @@ include $(linphone-root-dir)/submodules/bcg729/Android.mk
include $(linphone-root-dir)/submodules/bcg729/msbcg729/Android.mk
endif
+ifneq ($(BUILD_OPUS), 0)
+include $(linphone-root-dir)/submodules/externals/build/opus/Android.mk
+endif
+
ifneq ($(BUILD_WEBRTC_AECM), 0)
ifneq ($(TARGET_ARCH), x86)
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
diff --git a/jni/Application.mk b/jni/Application.mk
index 002eade0d..eb4892919 100644
--- a/jni/Application.mk
+++ b/jni/Application.mk
@@ -62,6 +62,10 @@ ifeq ($(BUILD_G729),1)
APP_MODULES +=libbcg729 libmsbcg729
endif
+ifneq ($(BUILD_OPUS), 0)
+APP_MODULES += libopus
+endif
+
ifneq ($(BUILD_WEBRTC_AECM), 0)
APP_MODULES += libwebrtc_system_wrappers libwebrtc_spl libwebrtc_apm_utility libwebrtc_aecm
APP_MODULES += libwebrtc_spl_neon libwebrtc_aecm_neon
diff --git a/project.properties b/project.properties
index 019cc5583..a2bff5858 100644
--- a/project.properties
+++ b/project.properties
@@ -11,5 +11,5 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
-target=android-17
+target=android-18
android.library=false
diff --git a/res/values/non_localizable_defaults.xml b/res/values/non_localizable_defaults.xml
index e0f898586..e2b1c209c 100644
--- a/res/values/non_localizable_defaults.xml
+++ b/res/values/non_localizable_defaults.xml
@@ -7,6 +7,7 @@
true
+ true
true
true
true
diff --git a/res/values/non_localizable_strings.xml b/res/values/non_localizable_strings.xml
index f4e012fb0..557f9092a 100644
--- a/res/values/non_localizable_strings.xml
+++ b/res/values/non_localizable_strings.xml
@@ -89,6 +89,7 @@
pref_codec_silk12_key
pref_codec_silk16_key
pref_codec_silk24_key
+ pref_codec_opus_key
pref_codecs_key
pref_stun_server_key
pref_ice_enable_key
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9cb1f40b0..7ee9ae3e9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -155,6 +155,7 @@
ilbc
speex 8 Khz
speex 16 Khz
+ opus 48Khz
silk 8 Khz
silk 12 Khz
silk 16 Khz
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index be27c9300..66262852a 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -62,6 +62,9 @@
android:key="@string/pref_codecs_key">
diff --git a/src/org/linphone/PreferencesFragment.java b/src/org/linphone/PreferencesFragment.java
index cade9616f..bf6c196d9 100644
--- a/src/org/linphone/PreferencesFragment.java
+++ b/src/org/linphone/PreferencesFragment.java
@@ -146,6 +146,7 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
detectAudioCodec(R.string.pref_codec_silk16_key,"SILK",16000, 1, true);
//detectAudioCodec(R.string.pref_codec_silk24_key,"SILK",24000, 1, true);
detectAudioCodec(R.string.pref_codec_g729_key,"G729",8000, 1, true);
+ detectAudioCodec(R.string.pref_codec_opus_key,"OPUS",48000, 1, true);
// No video
if (!Version.isVideoCapable()) {
diff --git a/submodules/externals/build/opus/Android.mk b/submodules/externals/build/opus/Android.mk
new file mode 100644
index 000000000..6bd994503
--- /dev/null
+++ b/submodules/externals/build/opus/Android.mk
@@ -0,0 +1,98 @@
+LOCAL_PATH:= $(call my-dir)/../../opus
+
+BUILD_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libopus
+
+
+LOCAL_SRC_FILES += \
+ celt/bands.c celt/celt.c celt/cwrs.c \
+ celt/entcode.c celt/entdec.c celt/entenc.c celt/kiss_fft.c \
+ celt/laplace.c celt/mathops.c celt/mdct.c celt/modes.c \
+ celt/pitch.c celt/celt_lpc.c celt/quant_bands.c celt/rate.c \
+ celt/vq.c silk/CNG.c silk/code_signs.c silk/init_decoder.c \
+ celt/celt_encoder.c celt/celt_decoder.c \
+ silk/decode_core.c silk/decode_frame.c \
+ silk/decode_parameters.c silk/decode_indices.c \
+ silk/decode_pulses.c silk/decoder_set_fs.c silk/dec_API.c \
+ silk/enc_API.c silk/encode_indices.c silk/encode_pulses.c \
+ silk/gain_quant.c silk/interpolate.c silk/LP_variable_cutoff.c \
+ silk/NLSF_decode.c silk/NSQ.c silk/NSQ_del_dec.c silk/PLC.c \
+ silk/shell_coder.c silk/tables_gain.c silk/tables_LTP.c \
+ silk/tables_NLSF_CB_NB_MB.c silk/tables_NLSF_CB_WB.c \
+ silk/tables_other.c silk/tables_pitch_lag.c \
+ silk/tables_pulses_per_block.c silk/VAD.c \
+ silk/control_audio_bandwidth.c silk/quant_LTP_gains.c \
+ silk/VQ_WMat_EC.c silk/HP_variable_cutoff.c silk/NLSF_encode.c \
+ silk/NLSF_VQ.c silk/NLSF_unpack.c silk/NLSF_del_dec_quant.c \
+ silk/process_NLSFs.c silk/stereo_LR_to_MS.c \
+ silk/stereo_MS_to_LR.c silk/check_control_input.c \
+ silk/control_SNR.c silk/init_encoder.c silk/control_codec.c \
+ silk/A2NLSF.c silk/ana_filt_bank_1.c silk/biquad_alt.c \
+ silk/bwexpander_32.c silk/bwexpander.c silk/debug.c \
+ silk/decode_pitch.c silk/inner_prod_aligned.c silk/lin2log.c \
+ silk/log2lin.c silk/LPC_analysis_filter.c \
+ silk/LPC_inv_pred_gain.c silk/table_LSF_cos.c silk/NLSF2A.c \
+ silk/NLSF_stabilize.c silk/NLSF_VQ_weights_laroia.c \
+ silk/pitch_est_tables.c silk/resampler.c \
+ silk/resampler_down2_3.c silk/resampler_down2.c \
+ silk/resampler_private_AR2.c silk/resampler_private_down_FIR.c \
+ silk/resampler_private_IIR_FIR.c \
+ silk/resampler_private_up2_HQ.c silk/resampler_rom.c \
+ silk/sigm_Q15.c silk/sort.c silk/sum_sqr_shift.c \
+ silk/stereo_decode_pred.c silk/stereo_encode_pred.c \
+ silk/stereo_find_predictor.c silk/stereo_quant_pred.c \
+ silk/fixed/LTP_analysis_filter_FIX.c \
+ silk/fixed/LTP_scale_ctrl_FIX.c silk/fixed/corrMatrix_FIX.c \
+ silk/fixed/encode_frame_FIX.c silk/fixed/find_LPC_FIX.c \
+ silk/fixed/find_LTP_FIX.c silk/fixed/find_pitch_lags_FIX.c \
+ silk/fixed/find_pred_coefs_FIX.c \
+ silk/fixed/noise_shape_analysis_FIX.c \
+ silk/fixed/prefilter_FIX.c silk/fixed/process_gains_FIX.c \
+ silk/fixed/regularize_correlations_FIX.c \
+ silk/fixed/residual_energy16_FIX.c \
+ silk/fixed/residual_energy_FIX.c silk/fixed/solve_LS_FIX.c \
+ silk/fixed/warped_autocorrelation_FIX.c \
+ silk/fixed/apply_sine_window_FIX.c silk/fixed/autocorr_FIX.c \
+ silk/fixed/burg_modified_FIX.c silk/fixed/k2a_FIX.c \
+ silk/fixed/k2a_Q16_FIX.c silk/fixed/pitch_analysis_core_FIX.c \
+ silk/fixed/vector_ops_FIX.c silk/fixed/schur64_FIX.c \
+ silk/fixed/schur_FIX.c silk/float/apply_sine_window_FLP.c \
+ silk/float/corrMatrix_FLP.c silk/float/encode_frame_FLP.c \
+ silk/float/find_LPC_FLP.c silk/float/find_LTP_FLP.c \
+ silk/float/find_pitch_lags_FLP.c \
+ silk/float/find_pred_coefs_FLP.c \
+ silk/float/LPC_analysis_filter_FLP.c \
+ silk/float/LTP_analysis_filter_FLP.c \
+ silk/float/LTP_scale_ctrl_FLP.c \
+ silk/float/noise_shape_analysis_FLP.c \
+ silk/float/prefilter_FLP.c silk/float/process_gains_FLP.c \
+ silk/float/regularize_correlations_FLP.c \
+ silk/float/residual_energy_FLP.c silk/float/solve_LS_FLP.c \
+ silk/float/warped_autocorrelation_FLP.c \
+ silk/float/wrappers_FLP.c silk/float/autocorrelation_FLP.c \
+ silk/float/burg_modified_FLP.c silk/float/bwexpander_FLP.c \
+ silk/float/energy_FLP.c silk/float/inner_product_FLP.c \
+ silk/float/k2a_FLP.c silk/float/levinsondurbin_FLP.c \
+ silk/float/LPC_inv_pred_gain_FLP.c \
+ silk/float/pitch_analysis_core_FLP.c \
+ silk/float/scale_copy_vector_FLP.c \
+ silk/float/scale_vector_FLP.c silk/float/schur_FLP.c \
+ silk/float/sort_FLP.c src/opus.c src/opus_decoder.c \
+ src/opus_encoder.c src/opus_multistream.c src/repacketizer.c \
+ src/analysis.c src/mlp.c src/mlp_data.c
+
+LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH)/include \
+ $(LOCAL_PATH)/celt \
+ $(LOCAL_PATH)/silk \
+ $(LOCAL_PATH)/silk/float
+
+LOCAL_CFLAGS += -include ../build/opus/config.h
+
+
+LOCAL_ARM_MODE := arm
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/submodules/externals/build/opus/config.h b/submodules/externals/build/opus/config.h
new file mode 100644
index 000000000..284c31e1e
--- /dev/null
+++ b/submodules/externals/build/opus/config.h
@@ -0,0 +1,140 @@
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Custom modes */
+/* #undef CUSTOM_MODES */
+
+/* Assertions */
+/* #undef ENABLE_ASSERTIONS */
+
+/* Debug fixed-point implementation */
+/* #undef FIXED_DEBUG */
+
+/* Compile as fixed-point (for machines without a fast enough FPU) */
+/* #undef FIXED_POINT */
+
+/* Float approximations */
+/* #undef FLOAT_APPROX */
+
+/* Fuzzing */
+/* #undef FUZZING */
+
+/* Define to 1 if you have the header file. */
+#define HAVE_ALLOCA_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_GETOPT_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `lrint' function. */
+#define HAVE_LRINT 1
+
+/* Define to 1 if you have the `lrintf' function. */
+#define HAVE_LRINTF 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `__malloc_hook' function. */
+#define HAVE___MALLOC_HOOK 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* This is a build of OPUS */
+#define OPUS_BUILD /**/
+
+/* Opus library version string */
+#define OPUS_VERSION "1.0.2-2-g48e62c5"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* The size of `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of `long', as computed by sizeof. */
+#define SIZEOF_LONG 8
+
+/* The size of `long long', as computed by sizeof. */
+#define SIZEOF_LONG_LONG 8
+
+/* The size of `short', as computed by sizeof. */
+#define SIZEOF_SHORT 2
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Make use of alloca */
+/* #undef USE_ALLOCA */
+
+/* Use C99 variable-size arrays */
+#define VAR_ARRAYS /**/
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to the equivalent of the C99 'restrict' keyword, or to
+ nothing if this is not supported. Do not define if restrict is
+ supported directly. */
+#define restrict __restrict
+/* Work around a bug in Sun C++: it does not support _Restrict or
+ __restrict__, even though the corresponding Sun C compiler ends up with
+ "#define restrict _Restrict" or "#define restrict __restrict__" in the
+ previous line. Perhaps some future version of Sun C++ will work with
+ restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
+#if defined __SUNPRO_CC && !defined __RESTRICT
+# define _Restrict
+# define __restrict__
+#endif
diff --git a/submodules/externals/opus b/submodules/externals/opus
new file mode 160000
index 000000000..fcecd29ab
--- /dev/null
+++ b/submodules/externals/opus
@@ -0,0 +1 @@
+Subproject commit fcecd29abf32164326e568acdcdf7d8e877b33b1
diff --git a/submodules/linphone b/submodules/linphone
index ab2b7d0e3..632f0ac00 160000
--- a/submodules/linphone
+++ b/submodules/linphone
@@ -1 +1 @@
-Subproject commit ab2b7d0e38e40c362015ed04e699f8c4286e064b
+Subproject commit 632f0ac005b532e3a5d1b8ba3ef550df789b10ee