From 0598e2eb78141dd2520bfa942e22cf26455a19cb Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Fri, 14 Aug 2015 09:55:47 +0200 Subject: [PATCH 01/16] Updated version 2.5 --- AndroidManifest.xml | 2 +- ant.properties | 2 +- submodules/linphone | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 4bda42092..571337975 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,7 +1,7 @@ + android:versionCode="2500" android:installLocation="auto"> diff --git a/ant.properties b/ant.properties index d2cc146d1..41ee35579 100644 --- a/ant.properties +++ b/ant.properties @@ -1,4 +1,4 @@ source.dir=src:submodules/linphone/mediastreamer2/java/src:submodules/linphone/java/j2se:submodules/linphone/java/common:submodules/linphone/java/impl:submodules/linphone/coreapi/help/java:submodules/externals/axmlrpc/src/main/java key.store=bc-android.keystore key.alias=nw8000 -version.name=2.4.0 +version.name=2.5.0 diff --git a/submodules/linphone b/submodules/linphone index 075f13f23..e369f0e28 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 075f13f233c21caec79ca0e3ed3796f0e0082e4f +Subproject commit e369f0e284337f6a369a160ae92a714a1684a227 From 5776b048c7af9c0ad68913c0a319d95816c8dde8 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 19 Aug 2015 18:05:28 +0200 Subject: [PATCH 02/16] update linphone submodule to fix webrtc interop --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index e369f0e28..c578229f9 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit e369f0e284337f6a369a160ae92a714a1684a227 +Subproject commit c578229f92c9da940e01639df1998480180ab309 From 3170f056d9e2b9f62ac6d17a9f86ddd438fc8edf Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 20 Aug 2015 17:47:39 +0200 Subject: [PATCH 03/16] update msopenh264 to fix increasing sps/pps always changing --- submodules/msopenh264 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/msopenh264 b/submodules/msopenh264 index 0722c480d..9be271700 160000 --- a/submodules/msopenh264 +++ b/submodules/msopenh264 @@ -1 +1 @@ -Subproject commit 0722c480d61746e9ab36f76b04ab2f3210890d07 +Subproject commit 9be271700b377a251b95e9d8dbe0e8b878a403ac From 2dd563e3819ab4da3eaad4703fc3dac91b22a431 Mon Sep 17 00:00:00 2001 From: Johan Pascal Date: Fri, 21 Aug 2015 18:06:12 +0200 Subject: [PATCH 04/16] Add codec2 submodules - update linphone --- .gitmodules | 3 + Makefile | 28 +++- README | 3 + jni/Android.mk | 5 + jni/Application.mk | 8 + submodules/externals/build/codec2/Android.mk | 43 +++++ .../build/codec2/codec2_prefixed_symbols.h | 154 ++++++++++++++++++ submodules/linphone | 2 +- submodules/mscodec2 | 1 + 9 files changed, 244 insertions(+), 3 deletions(-) create mode 100644 submodules/externals/build/codec2/Android.mk create mode 100644 submodules/externals/build/codec2/codec2_prefixed_symbols.h create mode 160000 submodules/mscodec2 diff --git a/.gitmodules b/.gitmodules index 3138e5888..21d5755ff 100644 --- a/.gitmodules +++ b/.gitmodules @@ -91,3 +91,6 @@ [submodule "submodules/externals/webrtc"] path = submodules/externals/webrtc url = git://git.linphone.org/webrtc.git +[submodule "submodules/mscodec2"] + path = submodules/mscodec2 + url = git://git.linphone.org/mscodec2.git diff --git a/Makefile b/Makefile index 08ed199c8..ae73fd666 100644 --- a/Makefile +++ b/Makefile @@ -60,6 +60,7 @@ BUILD_CONTACT_HEADER=0 BUILD_RTP_MAP=0 BUILD_DONT_CHECK_HEADERS_IN_MESSAGE=0 BUILD_ILBC=1 +BUILD_CODEC2=0 LIBLINPHONE_EXTENDED_SRC_FILES= LIBLINPHONE_EXTENDED_C_INCLUDES= LIBLINPHONE_EXTENDED_CFLAGS= @@ -255,6 +256,29 @@ clean-x264: rm -rf $(X264_BUILD_DIR)/arm && \ rm -rf $(X264_BUILD_DIR)/x86 +#codec2 +ifeq ($(BUILD_CODEC2),1) +CODEC2_SRC_DIR=$(TOPDIR)/submodules/externals/codec2 +CODEC2_BUILD_DIR=$(TOPDIR)/submodules/externals/build/codec2 +PREPARE_CODEC2_DEPS=codec2-install-headers +endif + +fetch-codec2: +ifneq "$(wildcard $(CODEC2_SRC_DIR) )" "" + # source directory for codec2 already exists, update it + svn up $(CODEC2_SRC_DIR) +else + #source directory for codec2 doesn't exist, create it and fetch the source from svn depot + mkdir $(CODEC2_SRC_DIR) + svn co https://svn.code.sf.net/p/freetel/code/codec2/branches/0.3/ $(CODEC2_SRC_DIR) +endif + +codec2-install-headers: fetch-codec2 + mkdir -p $(CODEC2_SRC_DIR)/include/codec2 + rsync -rvLpgoc $(CODEC2_SRC_DIR)/src/codec2.h $(CODEC2_SRC_DIR)/include/codec2/codec2.h + +prepare-codec2: $(PREPARE_CODEC2_DEPS) + #openh264 ifeq ($(BUILD_VIDEO),1) ifeq ($(BUILD_OPENH264), 1) @@ -409,10 +433,10 @@ $(MATROSKA_SRC_DIR)/patch_applied.txt: $(MATROSKA_BUILD_DIR)/fix_libmatroska2.pa cd $(MATROSKA_SRC_DIR); patch -p1 < $<; touch $@ #Build targets -prepare-sources: build-ffmpeg build-x264 build-openh264 prepare-ilbc build-vpx prepare-srtp prepare-mediastreamer2 prepare-antlr3 prepare-belle-sip $(TOPDIR)/res/raw/rootca.pem prepare-matroska2 +prepare-sources: build-ffmpeg build-x264 build-openh264 prepare-ilbc build-vpx prepare-srtp prepare-mediastreamer2 prepare-antlr3 prepare-belle-sip $(TOPDIR)/res/raw/rootca.pem prepare-matroska2 prepare-codec2 GENERATE_OPTIONS = NDK_DEBUG=$(NDK_DEBUG) BUILD_FOR_X86=$(BUILD_FOR_X86) \ - BUILD_AMRNB=$(BUILD_AMRNB) BUILD_AMRWB=$(BUILD_AMRWB) BUILD_SILK=$(BUILD_SILK) BUILD_G729=$(BUILD_G729) BUILD_OPUS=$(BUILD_OPUS) \ + BUILD_AMRNB=$(BUILD_AMRNB) BUILD_AMRWB=$(BUILD_AMRWB) BUILD_SILK=$(BUILD_SILK) BUILD_G729=$(BUILD_G729) BUILD_OPUS=$(BUILD_OPUS) BUILD_CODEC2=$(BUILD_CODEC2)\ BUILD_VIDEO=$(BUILD_VIDEO) BUILD_X264=$(BUILD_X264) BUILD_OPENH264=$(BUILD_OPENH264) ENABLE_OPENH264_DECODER=$(ENABLE_OPENH264_DECODER) BUILD_MATROSKA=$(BUILD_MATROSKA) \ BUILD_UPNP=$(BUILD_UPNP) BUILD_ZRTP=$(BUILD_ZRTP) BUILD_WEBRTC_AECM=$(BUILD_WEBRTC_AECM) BUILD_WEBRTC_ISAC=$(BUILD_WEBRTC_ISAC) BUILD_ILBC=$(BUILD_ILBC) \ BUILD_FOR_ARM=$(BUILD_FOR_ARM) BUILD_NON_FREE_CODECS=$(BUILD_NON_FREE_CODECS) diff --git a/README b/README index 1ceb2271b..960700b70 100644 --- a/README +++ b/README @@ -144,3 +144,6 @@ BUILD_MATROSKA BUILD_ILBC values: 0 (don't build iLBC), 1 (do build iLBC), default value: 1 + +BUILD_CODEC2 + values: 0 (don't build codec2 support), 1 (do build codec2 support), default value: 0 diff --git a/jni/Android.mk b/jni/Android.mk index c1951fdde..4a2928c3e 100755 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -86,6 +86,11 @@ ifeq ($(BUILD_ILBC), 1) include $(linphone-root-dir)/submodules/msilbc/Android.mk endif +ifeq ($(BUILD_CODEC2), 1) +include $(linphone-root-dir)/submodules/mscodec2/Android.mk +include $(linphone-root-dir)/submodules/externals/build/codec2/Android.mk +endif + ifeq ($(_BUILD_VIDEO),1) ifeq ($(_BUILD_X264),1) diff --git a/jni/Application.mk b/jni/Application.mk index 62337407e..ab32cd6d1 100644 --- a/jni/Application.mk +++ b/jni/Application.mk @@ -36,6 +36,10 @@ ifeq ($(BUILD_G729),) BUILD_G729=0 endif +ifeq ($(BUILD_CODEC2),) +BUILD_CODEC2=0 +endif + ifeq ($(BUILD_VIDEO),) BUILD_VIDEO=1 endif @@ -127,6 +131,10 @@ ifeq ($(BUILD_ZRTP), 1) APP_MODULES += libbzrtp endif +ifeq ($(BUILD_CODEC2), 1) +APP_MODULES +=libcodec2 libmscodec2 +endif + ifeq ($(BUILD_ILBC), 1) APP_MODULES +=libmsilbc endif diff --git a/submodules/externals/build/codec2/Android.mk b/submodules/externals/build/codec2/Android.mk new file mode 100644 index 000000000..18c2a4119 --- /dev/null +++ b/submodules/externals/build/codec2/Android.mk @@ -0,0 +1,43 @@ +LOCAL_PATH:= $(call my-dir)/../../codec2 + +BUILD_PATH:= $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := libcodec2 + + +LOCAL_SRC_FILES += \ + src/dump.c \ + src/lpc.c \ + src/nlp.c \ + src/postfilter.c \ + src/sine.c \ + src/codec2.c \ + src/fifo.c \ + src/fdmdv.c \ + src/kiss_fft.c \ + src/interp.c \ + src/lsp.c \ + src/phase.c \ + src/quantise.c \ + src/pack.c \ + src/codebook.c \ + src/codebookd.c \ + src/codebookvq.c \ + src/codebookjnd.c \ + src/codebookjvm.c \ + src/codebookvqanssi.c \ + src/codebookdt.c \ + src/codebookge.c \ + src/golay23.c + +LOCAL_C_INCLUDES += \ + $(LOCAL_PATH)/src + +LOCAL_CFLAGS := -ffast-math -include $(BUILD_PATH)/codec2_prefixed_symbols.h + + +LOCAL_ARM_MODE := arm + +include $(BUILD_STATIC_LIBRARY) diff --git a/submodules/externals/build/codec2/codec2_prefixed_symbols.h b/submodules/externals/build/codec2/codec2_prefixed_symbols.h new file mode 100644 index 000000000..d2aefca1a --- /dev/null +++ b/submodules/externals/build/codec2/codec2_prefixed_symbols.h @@ -0,0 +1,154 @@ +/* This file was created extracting exported symbol of codec2 library + * The purpose is to avoid name collision with other libraries + * This was done by the following command + * nm libcodec2.so|grep " T "|sed 's/^.*\ T\ \(.*\)/#define\ \1 codec2_\1/' + * */ +#define autocorrelate codec2_autocorrelate +#define de_emp codec2_de_emp +#define find_aks codec2_find_aks +#define hanning_window codec2_hanning_window +#define inverse_filter codec2_inverse_filter +#define levinson_durbin codec2_levinson_durbin +#define pre_emp codec2_pre_emp +#define synthesis_filter codec2_synthesis_filter +#define weight codec2_weight +#define nlp codec2_nlp +#define nlp_create codec2_nlp_create +#define nlp_destroy codec2_nlp_destroy +#define post_process_mbe codec2_post_process_mbe +#define post_process_sub_multiples codec2_post_process_sub_multiples +#define test_candidate_mbe codec2_test_candidate_mbe +#define postfilter codec2_postfilter +#define codec2_rand codec2_codec2_rand +#define dft_speech codec2_dft_speech +#define estimate_amplitudes codec2_estimate_amplitudes +#define est_voicing_mbe codec2_est_voicing_mbe +#define hpf codec2_hpf +#define hs_pitch_refinement codec2_hs_pitch_refinement +#define make_analysis_window codec2_make_analysis_window +#define make_synthesis_window codec2_make_synthesis_window +#define synthesise codec2_synthesise +#define two_stage_pitch_refinement codec2_two_stage_pitch_refinement +#define analyse_one_frame codec2_analyse_one_frame +#define codec2_bits_per_frame codec2_codec2_bits_per_frame +#define codec2_create codec2_codec2_create +#define codec2_decode codec2_codec2_decode +#define codec2_decode_1200 codec2_codec2_decode_1200 +#define codec2_decode_1300 codec2_codec2_decode_1300 +#define codec2_decode_1400 codec2_codec2_decode_1400 +#define codec2_decode_1600 codec2_codec2_decode_1600 +#define codec2_decode_2400 codec2_codec2_decode_2400 +#define codec2_decode_3200 codec2_codec2_decode_3200 +#define codec2_decode_ber codec2_codec2_decode_ber +#define codec2_destroy codec2_codec2_destroy +#define codec2_encode codec2_codec2_encode +#define codec2_encode_1200 codec2_codec2_encode_1200 +#define codec2_encode_1300 codec2_codec2_encode_1300 +#define codec2_encode_1400 codec2_codec2_encode_1400 +#define codec2_encode_1600 codec2_codec2_encode_1600 +#define codec2_encode_2400 codec2_codec2_encode_2400 +#define codec2_encode_3200 codec2_codec2_encode_3200 +#define codec2_get_spare_bit_index codec2_codec2_get_spare_bit_index +#define codec2_rebuild_spare_bit codec2_codec2_rebuild_spare_bit +#define codec2_samples_per_frame codec2_codec2_samples_per_frame +#define codec2_set_lpc_post_filter codec2_codec2_set_lpc_post_filter +#define codec2_set_natural_or_gray codec2_codec2_set_natural_or_gray +#define synthesise_one_frame codec2_synthesise_one_frame +#define fifo_create codec2_fifo_create +#define fifo_destroy codec2_fifo_destroy +#define fifo_read codec2_fifo_read +#define fifo_used codec2_fifo_used +#define fifo_write codec2_fifo_write +#define bits_to_dqpsk_symbols codec2_bits_to_dqpsk_symbols +#define calc_snr codec2_calc_snr +#define fdm_downconvert codec2_fdm_downconvert +#define fdmdv_48_to_8 codec2_fdmdv_48_to_8 +#define fdmdv_8_to_48 codec2_fdmdv_8_to_48 +#define fdmdv_bits_per_frame codec2_fdmdv_bits_per_frame +#define fdmdv_create codec2_fdmdv_create +#define fdmdv_demod codec2_fdmdv_demod +#define fdmdv_destroy codec2_fdmdv_destroy +#define fdmdv_dump_osc_mags codec2_fdmdv_dump_osc_mags +#define fdmdv_error_pattern_size codec2_fdmdv_error_pattern_size +#define fdmdv_freq_shift codec2_fdmdv_freq_shift +#define fdmdv_get_demod_stats codec2_fdmdv_get_demod_stats +#define fdmdv_get_fsep codec2_fdmdv_get_fsep +#define fdmdv_get_rx_spectrum codec2_fdmdv_get_rx_spectrum +#define fdmdv_get_test_bits codec2_fdmdv_get_test_bits +#define fdmdv_mod codec2_fdmdv_mod +#define fdmdv_put_test_bits codec2_fdmdv_put_test_bits +#define fdmdv_set_fsep codec2_fdmdv_set_fsep +#define fdmdv_use_old_qpsk_mapping codec2_fdmdv_use_old_qpsk_mapping +#define fdm_upconvert codec2_fdm_upconvert +#define freq_state codec2_freq_state +#define generate_pilot_fdm codec2_generate_pilot_fdm +#define generate_pilot_lut codec2_generate_pilot_lut +#define lpf_peak_pick codec2_lpf_peak_pick +#define qpsk_to_bits codec2_qpsk_to_bits +#define rx_est_freq_offset codec2_rx_est_freq_offset +#define rx_est_timing codec2_rx_est_timing +#define rx_filter codec2_rx_filter +#define snr_update codec2_snr_update +#define tx_filter codec2_tx_filter +#define kiss_fft codec2_kiss_fft +#define kiss_fft_alloc codec2_kiss_fft_alloc +#define kiss_fft_cleanup codec2_kiss_fft_cleanup +#define kiss_fft_next_fast_size codec2_kiss_fft_next_fast_size +#define kiss_fft_stride codec2_kiss_fft_stride +#define interp_energy codec2_interp_energy +#define interp_energy2 codec2_interp_energy2 +#define interpolate codec2_interpolate +#define interpolate_lsp codec2_interpolate_lsp +#define interpolate_lsp_ver2 codec2_interpolate_lsp_ver2 +#define interp_Wo codec2_interp_Wo +#define interp_Wo2 codec2_interp_Wo2 +#define sample_log_amp codec2_sample_log_amp +#define lpc_to_lsp codec2_lpc_to_lsp +#define lsp_to_lpc codec2_lsp_to_lpc +#define aks_to_H codec2_aks_to_H +#define phase_synth_zero_order codec2_phase_synth_zero_order +#define aks_to_M2 codec2_aks_to_M2 +#define apply_lpc_correction codec2_apply_lpc_correction +#define bw_expand_lsps codec2_bw_expand_lsps +#define bw_expand_lsps2 codec2_bw_expand_lsps2 +#define check_lsp_order codec2_check_lsp_order +#define compute_weights codec2_compute_weights +#define compute_weights2 codec2_compute_weights2 +#define compute_weights_anssi_mode2 codec2_compute_weights_anssi_mode2 +#define decode_energy codec2_decode_energy +#define decode_lspds_scalar codec2_decode_lspds_scalar +#define decode_lsps_scalar codec2_decode_lsps_scalar +#define decode_lsps_vq codec2_decode_lsps_vq +#define decode_Wo codec2_decode_Wo +#define decode_Wo_dt codec2_decode_Wo_dt +#define decode_WoE codec2_decode_WoE +#define encode_energy codec2_encode_energy +#define encode_lspds_scalar codec2_encode_lspds_scalar +#define encode_lsps_scalar codec2_encode_lsps_scalar +#define encode_lsps_vq codec2_encode_lsps_vq +#define encode_Wo codec2_encode_Wo +#define encode_Wo_dt codec2_encode_Wo_dt +#define encode_WoE codec2_encode_WoE +#define find_nearest codec2_find_nearest +#define find_nearest_weighted codec2_find_nearest_weighted +#define force_min_lsp_dist codec2_force_min_lsp_dist +#define locate_lsps_jnd_steps codec2_locate_lsps_jnd_steps +#define lpc_post_filter codec2_lpc_post_filter +#define lsp_bits codec2_lsp_bits +#define lspd_bits codec2_lspd_bits +#define lspjvm_quantise codec2_lspjvm_quantise +#define lsp_pred_vq_bits codec2_lsp_pred_vq_bits +#define quantise codec2_quantise +#define quantise_init codec2_quantise_init +#define quantise_WoE codec2_quantise_WoE +#define speech_to_uq_lsps codec2_speech_to_uq_lsps +#define pack codec2_pack +#define pack_natural_or_gray codec2_pack_natural_or_gray +#define unpack codec2_unpack +#define unpack_natural_or_gray codec2_unpack_natural_or_gray +#define get_syndrome codec2_get_syndrome +#define golay23_count_errors codec2_golay23_count_errors +#define golay23_decode codec2_golay23_decode +#define golay23_encode codec2_golay23_encode +#define golay23_init codec2_golay23_init +#define nextcomb codec2_nextcomb diff --git a/submodules/linphone b/submodules/linphone index c578229f9..7cbb44281 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit c578229f92c9da940e01639df1998480180ab309 +Subproject commit 7cbb44281c1ab12d90b3b712d2a9087df66207d2 diff --git a/submodules/mscodec2 b/submodules/mscodec2 new file mode 160000 index 000000000..64df6cb53 --- /dev/null +++ b/submodules/mscodec2 @@ -0,0 +1 @@ +Subproject commit 64df6cb53ceacdea74a021e83f664e9aaa140ef8 From c2075cc2a0c3954ad49944a70b06b8b01df13959 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 24 Aug 2015 17:17:38 +0200 Subject: [PATCH 05/16] Updated linphone submodule --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index 7cbb44281..e7dd35efa 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 7cbb44281c1ab12d90b3b712d2a9087df66207d2 +Subproject commit e7dd35efa0f0d250db66fadb11994b4f48e088b1 From 97a077900fcf6f4f738314d13e7484b0b7203d3f Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Tue, 25 Aug 2015 11:23:51 +0200 Subject: [PATCH 06/16] Fix crash with download picture and sync account --- src/org/linphone/ContactsManager.java | 16 +++++++++++---- src/org/linphone/LinphoneManager.java | 4 ++-- src/org/linphone/ui/BubbleChat.java | 28 ++++++++++++++------------- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/org/linphone/ContactsManager.java b/src/org/linphone/ContactsManager.java index 18bb50e09..295537d52 100644 --- a/src/org/linphone/ContactsManager.java +++ b/src/org/linphone/ContactsManager.java @@ -90,12 +90,20 @@ public class ContactsManager { public void initializeSyncAccount(Context context, ContentResolver contentResolver) { initializeContactManager(context,contentResolver); - Account newAccount = new Account(context.getString(R.string.sync_account_name), context.getString(R.string.sync_account_type)); AccountManager accountManager = (AccountManager) context.getSystemService(context.ACCOUNT_SERVICE); - if(accountManager.addAccountExplicitly(newAccount, null, null)){ - mAccount = newAccount; + + Account[] accounts = accountManager.getAccountsByType(context.getPackageName()); + + if(accounts != null && accounts.length == 0) { + Account newAccount = new Account(context.getString(R.string.sync_account_name), context.getPackageName()); + try { + accountManager.addAccountExplicitly(newAccount, null, null); + mAccount = newAccount; + } catch (Exception e) { + mAccount = null; + } } else { - mAccount = null; + mAccount = accounts[0]; } } diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 65515b557..ae597b8fa 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -284,9 +284,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag mUploadPendingFileMessage = null; mUploadingImageStream = null; } else { - File file = new File(Environment.getExternalStorageDirectory(), msg.getFileTransferInformation().getName()); + File file = new File(Environment.getExternalStorageDirectory(), msg.getAppData()); try { - String url = MediaStore.Images.Media.insertImage(getContext().getContentResolver(), file.getPath(), msg.getFileTransferInformation().getName(), null); + String url = MediaStore.Images.Media.insertImage(getContext().getContentResolver(), file.getPath(), file.getName(), null); msg.setAppData(url); file.delete(); } catch (FileNotFoundException e) { diff --git a/src/org/linphone/ui/BubbleChat.java b/src/org/linphone/ui/BubbleChat.java index 64a19d38f..94056d344 100644 --- a/src/org/linphone/ui/BubbleChat.java +++ b/src/org/linphone/ui/BubbleChat.java @@ -133,14 +133,8 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen ImageView imageView = (ImageView) view.findViewById(R.id.image); String appData = message.getAppData(); - if (appData == null) { + if (appData == null || (! LinphoneManager.getInstance().isMessagePending(nativeMessage) && appData.contains(context.getString(R.string.temp_photo_name_with_date).split("%s")[0]))) { LinphoneManager.addListener(this); - if(LinphoneManager.getInstance().isMessagePending(nativeMessage)){ - download.setEnabled(false); - ProgressBar spinner = (ProgressBar) view.findViewById(R.id.spinner); - spinner.setVisibility(View.VISIBLE); - download.setVisibility(View.GONE); - } else { download.setVisibility(View.VISIBLE); download.setOnClickListener(new OnClickListener() { @Override @@ -148,19 +142,27 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen v.setEnabled(false); spinner.setVisibility(View.VISIBLE); v.setVisibility(View.GONE); - - File file = new File(Environment.getExternalStorageDirectory(), nativeMessage.getFileTransferInformation().getName()); + String filename = context.getString(R.string.temp_photo_name_with_date).replace("%s", String.valueOf(System.currentTimeMillis())); + File file = new File(Environment.getExternalStorageDirectory(), filename); nativeMessage.setListener(LinphoneManager.getInstance()); nativeMessage.setFileTransferFilepath(file.getPath()); nativeMessage.downloadFile(); + nativeMessage.setAppData(filename); LinphoneManager.getInstance().addDownloadMessagePending(nativeMessage); } }); - } } else { - LinphoneManager.removeListener(this); - imageView.setVisibility(View.VISIBLE); - loadBitmap(appData, imageView); + if(LinphoneManager.getInstance().isMessagePending(nativeMessage)){ + LinphoneManager.addListener(this); + download.setEnabled(false); + ProgressBar spinner = (ProgressBar) view.findViewById(R.id.spinner); + spinner.setVisibility(View.VISIBLE); + download.setVisibility(View.GONE); + } else { + LinphoneManager.removeListener(this); + imageView.setVisibility(View.VISIBLE); + loadBitmap(appData, imageView); + } } } else { TextView msgView = (TextView) view.findViewById(R.id.message); From 4713fb4c68bb4995d9d6f2b6e849d2e0d82c17e3 Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Tue, 25 Aug 2015 12:00:55 +0200 Subject: [PATCH 07/16] Fix crash with memory error --- src/org/linphone/ChatFragment.java | 70 ++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 13 deletions(-) diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index aa4c66f16..16bef308b 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -89,8 +89,15 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC private static final int ADD_PHOTO = 1337; private static final int MENU_DELETE_MESSAGE = 0; + private static final int MENU_PICTURE_SMALL = 2; + private static final int MENU_PICTURE_MEDIUM = 3; + private static final int MENU_PICTURE_LARGE = 4; + private static final int MENU_PICTURE_REAL = 5; private static final int MENU_COPY_TEXT = 6; private static final int MENU_RESEND_MESSAGE = 7; + private static final int SIZE_SMALL = 500; + private static final int SIZE_MEDIUM = 1000; + private static final int SIZE_LARGE = 1500; private static final int SIZE_MAX = 2048; private LinphoneChatRoom chatRoom; @@ -107,6 +114,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC private ProgressBar progressBar; private Uri imageToUploadUri; + private String filePathToUpload; private TextWatcher textWatcher; private ViewTreeObserver.OnGlobalLayoutListener keyboardListener; private ChatMessageAdapter adapter; @@ -168,6 +176,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC pickImage(); } }); + //registerForContextMenu(sendImage); } else { sendImage.setEnabled(false); } @@ -414,8 +423,16 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { - menu.add(v.getId(), MENU_DELETE_MESSAGE, 0, getString(R.string.delete)); - menu.add(v.getId(), MENU_COPY_TEXT, 0, getString(R.string.copy_text)); + if (v.getId() == R.id.sendPicture) { + menu.add(0, MENU_PICTURE_SMALL, 0, getString(R.string.share_picture_size_small)); + menu.add(0, MENU_PICTURE_MEDIUM, 0, getString(R.string.share_picture_size_medium)); + menu.add(0, MENU_PICTURE_LARGE, 0, getString(R.string.share_picture_size_large)); + // Not a good idea, very big pictures cause Out of Memory exceptions, slow display, ... + // menu.add(0, MENU_PICTURE_REAL, 0, getString(R.string.share_picture_size_real)); + } else { + menu.add(v.getId(), MENU_DELETE_MESSAGE, 0, getString(R.string.delete)); + menu.add(v.getId(), MENU_COPY_TEXT, 0, getString(R.string.copy_text)); + } LinphoneChatMessage msg = getMessageForId(v.getId()); if (msg != null && msg.getStatus() == LinphoneChatMessage.State.NotDelivered) { @@ -441,6 +458,18 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC case MENU_RESEND_MESSAGE: resendMessage(item.getGroupId()); break; + case MENU_PICTURE_SMALL: + sendImageMessage(filePathToUpload, SIZE_SMALL); + break; + case MENU_PICTURE_MEDIUM: + sendImageMessage(filePathToUpload, SIZE_MEDIUM); + break; + case MENU_PICTURE_LARGE: + sendImageMessage(filePathToUpload, SIZE_LARGE); + break; + case MENU_PICTURE_REAL: + sendImageMessage(filePathToUpload, SIZE_MAX); + break; } return true; } @@ -556,17 +585,21 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } } - private void sendImageMessage(String path) { + private void sendImageMessage(String path, int imageSize) { LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable(); if (chatRoom != null && path != null && path.length() > 0 && isNetworkReachable) { - Bitmap bm = BitmapFactory.decodeFile(path); - if (bm != null) { - FileUploadPrepareTask task = new FileUploadPrepareTask(getActivity(), path); - task.execute(bm); - } else { - Log.e("Error, bitmap factory can't read " + path); + try { + Bitmap bm = BitmapFactory.decodeFile(path); + if (bm != null) { + FileUploadPrepareTask task = new FileUploadPrepareTask(getActivity(), path, imageSize); + task.execute(bm); + } else { + Log.e("Error, bitmap factory can't read " + path); + } + } catch (RuntimeException e) { + Log.e("Error, not enough memory to create the bitmap"); } } else if (!isNetworkReachable && LinphoneActivity.isInstanciated()) { LinphoneActivity.instance().displayCustomToast(getString(R.string.error_network_unreachable), Toast.LENGTH_LONG); @@ -575,11 +608,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC class FileUploadPrepareTask extends AsyncTask { private String path; + private int imageSize; private ProgressDialog progressDialog; - public FileUploadPrepareTask(Context context, String fileToUploadPath) { + public FileUploadPrepareTask(Context context, String fileToUploadPath, int size) { path = fileToUploadPath; - + imageSize = size; uploadLayout.setVisibility(View.VISIBLE); textLayout.setVisibility(View.GONE); @@ -675,7 +709,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC if (message.getText() != null && message.getText().length() > 0) { sendTextMessage(message.getText()); } else { - sendImageMessage(message.getAppData()); + sendImageMessage(message.getAppData(),0); } } @@ -722,6 +756,15 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC return null; } + private void showPopupMenuAskingImageSize(final String filePath) { + filePathToUpload = filePath; + try { + sendImage.showContextMenu(); + } catch (Exception e) { + e.printStackTrace(); + }; + } + @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == ADD_PHOTO && resultCode == Activity.RESULT_OK) { @@ -734,7 +777,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } if (fileToUploadPath != null) { - sendImageMessage(fileToUploadPath); + //showPopupMenuAskingImageSize(fileToUploadPath); + sendImageMessage(fileToUploadPath,0); } } else { super.onActivityResult(requestCode, resultCode, data); From 22479baea025cd10be16cdb13ab1f0cba318119a Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Fri, 28 Aug 2015 16:33:53 +0200 Subject: [PATCH 08/16] Fix echo cancellation preference --- .../linphone/setup/EchoCancellerCalibrationFragment.java | 6 ------ src/org/linphone/setup/SetupActivity.java | 3 --- 2 files changed, 9 deletions(-) diff --git a/src/org/linphone/setup/EchoCancellerCalibrationFragment.java b/src/org/linphone/setup/EchoCancellerCalibrationFragment.java index d3e317da4..2b0f350db 100644 --- a/src/org/linphone/setup/EchoCancellerCalibrationFragment.java +++ b/src/org/linphone/setup/EchoCancellerCalibrationFragment.java @@ -59,12 +59,6 @@ public class EchoCancellerCalibrationFragment extends Fragment { @Override public void ecCalibrationStatus(LinphoneCore lc,LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data) { LinphoneManager.getInstance().routeAudioToReceiver(); - - if (status == EcCalibratorStatus.DoneNoEcho) { - LinphonePreferences.instance().setEchoCancellation(false); - } else if ((status == EcCalibratorStatus.Done) || (status == EcCalibratorStatus.Failed)) { - LinphonePreferences.instance().setEchoCancellation(true); - } if (mSendEcCalibrationResult) { sendEcCalibrationResult(status, delay_ms); } else { diff --git a/src/org/linphone/setup/SetupActivity.java b/src/org/linphone/setup/SetupActivity.java index 62c70abc2..0b15b0406 100644 --- a/src/org/linphone/setup/SetupActivity.java +++ b/src/org/linphone/setup/SetupActivity.java @@ -223,9 +223,6 @@ public class SetupActivity extends FragmentActivity implements OnClickListener { next.setEnabled(false); cancel.setEnabled(false); } else { - if (mPrefs.isFirstLaunch()) { - mPrefs.setEchoCancellation(LinphoneManager.getLc().hasBuiltInEchoCanceler()); - } success(); } } From f1d2c1a6ea31676daf773b24f342ffc287c80ae6 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sun, 30 Aug 2015 15:29:48 +0200 Subject: [PATCH 09/16] upgrade to libvpx v1.4.0 This requires to make a clean of the build environment: cd submodules/external/libvpx && git reset --hard make clean make --- Makefile | 4 +- patches/libvpx_configure_android_x86.patch | 64 +++++++++++----------- submodules/externals/libvpx | 2 +- 3 files changed, 36 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index ae73fd666..6e4642c0b 100644 --- a/Makefile +++ b/Makefile @@ -342,13 +342,13 @@ LIBVPX_BUILD_DIR=$(TOPDIR)/submodules/externals/build/libvpx LIBVPX_CONFIGURE_OPTIONS=--disable-vp9 --disable-examples --disable-unit-tests --disable-postproc --enable-error-concealment --enable-debug $(LIBVPX_SRC_DIR)/configure_android_x86_patch_applied.txt: - @patch -p1 < $(TOPDIR)/patches/libvpx_configure_android_x86.patch + cd $(LIBVPX_SRC_DIR) && patch -p1 < $(TOPDIR)/patches/libvpx_configure_android_x86.patch touch $@ $(LIBVPX_BUILD_DIR)/arm/libvpx.a: mkdir -p $(LIBVPX_BUILD_DIR)/arm && \ cd $(LIBVPX_BUILD_DIR)/arm && \ - $(LIBVPX_SRC_DIR)/configure --target=armv7-android-gcc --sdk-path=$(NDK_PATH) $(LIBVPX_CONFIGURE_OPTIONS) && \ + $(LIBVPX_SRC_DIR)/configure --target=armv7-android-gcc --extra-cflags="-mfloat-abi=softfp -mfpu=neon" --sdk-path=$(NDK_PATH) $(LIBVPX_CONFIGURE_OPTIONS) && \ make -j${NUMCPUS} \ || ( echo "Build of libvpx for arm failed." ; exit 1 ) diff --git a/patches/libvpx_configure_android_x86.patch b/patches/libvpx_configure_android_x86.patch index 3496853dd..6c7f40e97 100644 --- a/patches/libvpx_configure_android_x86.patch +++ b/patches/libvpx_configure_android_x86.patch @@ -1,36 +1,38 @@ ---- a/submodules/externals/libvpx/build/make/configure.sh -+++ b/submodules/externals/libvpx/build/make/configure.sh -@@ -1037,6 +1037,33 @@ EOF - os2) - AS=${AS:-nasm} - ;; -+ android*) -+ SDK_PATH=${sdk_path} -+ COMPILER_LOCATION=`find "${SDK_PATH}" \ -+ -name "i686-linux-android-gcc*" -print -quit` -+ TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/i686-linux-android- -+ CC=${TOOLCHAIN_PATH}gcc -+ CXX=${TOOLCHAIN_PATH}g++ -+ AR=${TOOLCHAIN_PATH}ar -+ LD=${TOOLCHAIN_PATH}gcc -+ STRIP=${TOOLCHAIN_PATH}strip -+ NM=${TOOLCHAIN_PATH}nm +diff --git a/build/make/configure.sh b/build/make/configure.sh +index 25c9f80..336b006 100644 +--- a/build/make/configure.sh ++++ b/build/make/configure.sh +@@ -1082,6 +1082,33 @@ EOF + os2) + AS=${AS:-nasm} + ;; ++ android*) ++ SDK_PATH=${sdk_path} ++ COMPILER_LOCATION=`find "${SDK_PATH}" \ ++ -name "i686-linux-android-gcc*" -print -quit` ++ TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/i686-linux-android- ++ CC=${TOOLCHAIN_PATH}gcc ++ CXX=${TOOLCHAIN_PATH}g++ ++ AR=${TOOLCHAIN_PATH}ar ++ LD=${TOOLCHAIN_PATH}gcc ++ STRIP=${TOOLCHAIN_PATH}strip ++ NM=${TOOLCHAIN_PATH}nm + -+ if [ -z "${alt_libc}" ]; then -+ alt_libc=`find "${SDK_PATH}" -name arch-x86 -print | \ -+ awk '{n = split($0,a,"/"); \ -+ split(a[n-1],b,"-"); \ -+ print $0 " " b[2]}' | \ -+ sort -g -k 2 | \ -+ awk '{ print $1 }' | tail -1` -+ fi ++ if [ -z "${alt_libc}" ]; then ++ alt_libc=`find "${SDK_PATH}" -name arch-x86 -print | \ ++ awk '{n = split($0,a,"/"); \ ++ split(a[n-1],b,"-"); \ ++ print $0 " " b[2]}' | \ ++ sort -g -k 2 | \ ++ awk '{ print $1 }' | tail -1` ++ fi + -+ add_cflags "--sysroot=${alt_libc}" -+ add_ldflags "--sysroot=${alt_libc}" ++ add_cflags "--sysroot=${alt_libc}" ++ add_ldflags "--sysroot=${alt_libc}" + -+ soft_enable realtime_only -+ ;; ++ soft_enable realtime_only ++ ;; + - esac + esac - AS="${alt_as:-${AS:-auto}}" + AS="${alt_as:-${AS:-auto}}" diff --git a/submodules/externals/libvpx b/submodules/externals/libvpx index 2e88f2f2e..c74bf6d88 160000 --- a/submodules/externals/libvpx +++ b/submodules/externals/libvpx @@ -1 +1 @@ -Subproject commit 2e88f2f2ec777259bda1714e72f1ecd2519bceb5 +Subproject commit c74bf6d889992c3cabe017ec353ca85c323107cd From b3da0fac2e1c6a51681885ec4d32e03050fa6b6c Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 31 Aug 2015 12:10:37 +0200 Subject: [PATCH 10/16] Fix compilation when using SDK 23 --- .../linphone/compatibility/ApiFivePlus.java | 63 +++++++++---------- 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/src/org/linphone/compatibility/ApiFivePlus.java b/src/org/linphone/compatibility/ApiFivePlus.java index b0c66f825..82a95be4f 100644 --- a/src/org/linphone/compatibility/ApiFivePlus.java +++ b/src/org/linphone/compatibility/ApiFivePlus.java @@ -32,6 +32,7 @@ import android.provider.ContactsContract.CommonDataKinds; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Data; +import android.support.v4.app.NotificationCompat; import android.text.ClipboardManager; import android.text.TextUtils; import android.view.ViewTreeObserver; @@ -291,32 +292,28 @@ public class ApiFivePlus { } public static Notification createMessageNotification(Context context, String title, String msg, PendingIntent intent) { - Notification notif = new Notification(); - notif.icon = R.drawable.chat_icon_over; - notif.iconLevel = 0; - notif.when = System.currentTimeMillis(); - notif.flags &= Notification.FLAG_ONGOING_EVENT; - + NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context) + .setSmallIcon(R.drawable.chat_icon_over) + .setContentTitle(title) + .setContentText(msg) + .setContentIntent(intent); + + Notification notif = notifBuilder.build(); notif.defaults |= Notification.DEFAULT_VIBRATE; notif.defaults |= Notification.DEFAULT_SOUND; notif.defaults |= Notification.DEFAULT_LIGHTS; - notif.setLatestEventInfo(context, title, msg, intent); - return notif; } - public static Notification createInCallNotification(Context context, - String title, String msg, int iconID, PendingIntent intent) { - Notification notif = new Notification(); - notif.icon = iconID; - notif.iconLevel = 0; - notif.when = System.currentTimeMillis(); - notif.flags &= Notification.FLAG_ONGOING_EVENT; - - notif.setLatestEventInfo(context, title, msg, intent); - - return notif; + public static Notification createInCallNotification(Context context, String title, String msg, int iconID, PendingIntent intent) { + NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context) + .setSmallIcon(iconID) + .setContentTitle(title) + .setContentText(msg) + .setContentIntent(intent); + + return notifBuilder.build(); } public static void setPreferenceChecked(Preference preference, boolean checked) { @@ -390,31 +387,27 @@ public class ApiFivePlus { } public static Notification createNotification(Context context, String title, String message, int icon, int level, PendingIntent intent, boolean isOngoingEvent) { - Notification notif = new Notification(); - notif.icon = icon; - notif.iconLevel = level; - notif.when = System.currentTimeMillis(); - if (isOngoingEvent) { - notif.flags |= Notification.FLAG_ONGOING_EVENT; - } - notif.setLatestEventInfo(context, title, message, intent); + NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context) + .setSmallIcon(icon, level) + .setContentTitle(title) + .setContentText(message) + .setContentIntent(intent); - return notif; + return notifBuilder.build(); } public static Notification createSimpleNotification(Context context, String title, String text, PendingIntent intent) { - Notification notif = new Notification(); - notif.icon = R.drawable.logo_linphone_57x57; - notif.iconLevel = 0; - notif.when = System.currentTimeMillis(); - notif.flags &= Notification.FLAG_ONGOING_EVENT; + NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context) + .setSmallIcon(R.drawable.logo_linphone_57x57) + .setContentTitle(title) + .setContentText(text) + .setContentIntent(intent); + Notification notif = notifBuilder.build(); notif.defaults |= Notification.DEFAULT_VIBRATE; notif.defaults |= Notification.DEFAULT_SOUND; notif.defaults |= Notification.DEFAULT_LIGHTS; - notif.setLatestEventInfo(context, title, text, intent); - return notif; } } From 21ff92cb9fdef8957a111397fce117f44521f190 Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Thu, 3 Sep 2015 11:44:12 +0200 Subject: [PATCH 11/16] Fix scroll with image chat --- res/layout/chat_bubble_alt_incoming.xml | 19 +++++++++---------- res/layout/chat_bubble_alt_outgoing.xml | 17 +++++++++-------- res/layout/chat_bubble_incoming.xml | 6 +++--- res/layout/chat_bubble_outgoing.xml | 6 +++--- src/org/linphone/ui/BubbleChat.java | 14 +++++++------- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/res/layout/chat_bubble_alt_incoming.xml b/res/layout/chat_bubble_alt_incoming.xml index 5a5cea187..5ad94404b 100644 --- a/res/layout/chat_bubble_alt_incoming.xml +++ b/res/layout/chat_bubble_alt_incoming.xml @@ -12,16 +12,15 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" /> - - + +