From 075f13f233c21caec79ca0e3ed3796f0e0082e4f Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Wed, 12 Aug 2015 17:49:50 +0200 Subject: [PATCH] Remove textReceived callback Made echo calibration at start --- build/android/Android.mk | 1 + .../core/tutorials/TutorialBuddyStatus.java | 1 - .../core/tutorials/TutorialChatRoom.java | 4 -- .../core/tutorials/TutorialRegistration.java | 1 - coreapi/linphonecore_jni.cc | 40 +++++-------------- .../org/linphone/core/LinphoneCore.java | 2 +- .../linphone/core/LinphoneCoreListener.java | 9 ----- .../core/LinphoneCoreListenerBase.java | 7 ---- .../org/linphone/core/LinphoneCoreImpl.java | 6 +-- mediastreamer2 | 2 +- 10 files changed, 17 insertions(+), 56 deletions(-) diff --git a/build/android/Android.mk b/build/android/Android.mk index bb53ecf40..9fe43d362 100755 --- a/build/android/Android.mk +++ b/build/android/Android.mk @@ -118,6 +118,7 @@ LOCAL_C_INCLUDES += \ $(LOCAL_PATH)/../build/android \ $(LOCAL_PATH)/../oRTP/include \ $(LOCAL_PATH)/../mediastreamer2/include \ + $(LOCAL_PATH)/../mediastreamer2/src/audiofilters/ \ $(LOCAL_PATH)/../../belle-sip/include \ $(LOCAL_PATH)/../../../gen \ $(LOCAL_PATH)/../../externals/libxml2/include \ diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java index 22a850b36..82a094183 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java @@ -104,7 +104,6 @@ public class TutorialBuddyStatus implements LinphoneCoreListener { public void displayMessage(LinphoneCore lc, String message) {} public void displayWarning(LinphoneCore lc, String message) {} public void globalState(LinphoneCore lc, GlobalState state, String message) {} - public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {} public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg) {} public void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java index e8a7da936..11e436213 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java @@ -90,10 +90,6 @@ public class TutorialChatRoom implements LinphoneCoreListener, LinphoneChatMessa public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public void notifyReceived(LinphoneCore lc, LinphoneCall call, LinphoneAddress from, byte[] event){} public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {} - - public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) { - //Deprecated - } diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java index 44c432271..5a2db2568 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java @@ -88,7 +88,6 @@ public class TutorialRegistration implements LinphoneCoreListener { public void globalState(LinphoneCore lc, GlobalState state, String message) {} public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,String url) {} public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {} - public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {} public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg) {} public void callStatsUpdated(LinphoneCore lc, LinphoneCall call, LinphoneCallStats stats) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index b1aba031b..3f43bb41d 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -29,6 +29,7 @@ extern "C" { #include "mediastreamer2/mscommon.h" #include "mediastreamer2/msmediaplayer.h" #include "mediastreamer2/msutils.h" +#include "devices.h" } #include "mediastreamer2/msjava.h" #include "private.h" @@ -377,12 +378,6 @@ public: vTable->notify_presence_received = notify_presence_received; } - /*void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message);*/ - textReceivedId = env->GetMethodID(listenerClass,"textReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneAddress;Ljava/lang/String;)V"); - if (textReceivedId) { - vTable->text_received = text_received; - } - messageReceivedId = env->GetMethodID(listenerClass,"messageReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneChatRoom;Lorg/linphone/core/LinphoneChatMessage;)V"); if (messageReceivedId) { vTable->message_received = message_received; @@ -522,7 +517,6 @@ public: jmethodID displayStatusId; jmethodID newSubscriptionRequestId; jmethodID notifyPresenceReceivedId; - jmethodID textReceivedId; jmethodID messageReceivedId; jmethodID isComposingReceivedId; jmethodID dtmfReceivedId; @@ -786,23 +780,6 @@ public: ,dtmf); handle_possible_java_exception(env, lcData->listener); } - static void text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message) { - JNIEnv *env = 0; - jint result = jvm->AttachCurrentThread(&env,NULL); - if (result != 0) { - ms_error("cannot attach VM"); - return; - } - LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc); - LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table); - env->CallVoidMethod(lcData->listener - ,lcData->textReceivedId - ,lcData->core - ,env->NewObject(lcData->chatRoomClass,lcData->chatRoomCtrId,(jlong)room) - ,env->NewObject(lcData->addressClass,lcData->addressCtrId,(jlong)from) - ,message ? env->NewStringUTF(message) : NULL); - handle_possible_java_exception(env, lcData->listener); - } static void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *msg) { JNIEnv *env = 0; jobject jmsg; @@ -2008,24 +1985,29 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_needsEchoCalibration ms_error("Could not get soundcard %s", card); return TRUE; } + + SoundDeviceDescription *sound_description = sound_device_description_get(); + if(sound_description != NULL && sound_description == &genericSoundDeviceDescriptor){ + return TRUE; + } if (ms_snd_card_get_capabilities(sndcard) & MS_SND_CARD_CAP_BUILTIN_ECHO_CANCELLER) return FALSE; if (ms_snd_card_get_minimal_latency(sndcard) != 0) return FALSE; return TRUE; } -extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_needsEchoCanceler(JNIEnv *env, jobject thiz, jlong lc) { +extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_hasBuiltInEchoCanceler(JNIEnv *env, jobject thiz, jlong lc) { MSSndCard *sndcard; MSSndCardManager *m = ms_snd_card_manager_get(); const char *card = linphone_core_get_capture_device((LinphoneCore*)lc); sndcard = ms_snd_card_manager_get_card(m, card); if (sndcard == NULL) { ms_error("Could not get soundcard %s", card); - return TRUE; + return FALSE; } - - if (ms_snd_card_get_capabilities(sndcard) & MS_SND_CARD_CAP_BUILTIN_ECHO_CANCELLER) return FALSE; - return TRUE; + + if (ms_snd_card_get_capabilities(sndcard) & MS_SND_CARD_CAP_BUILTIN_ECHO_CANCELLER) return TRUE; + return FALSE; } extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getMediaEncryption(JNIEnv* env diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 410c8930e..e668520f9 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -1186,7 +1186,7 @@ public interface LinphoneCore { * Returns true if the software echo canceler needs to be turned on. * If the device has a builtin echo canceller, it will return false. */ - boolean needsEchoCanceler(); + boolean hasBuiltInEchoCanceler(); void enableIpv6(boolean enable); diff --git a/java/common/org/linphone/core/LinphoneCoreListener.java b/java/common/org/linphone/core/LinphoneCoreListener.java index 4067380a0..b7457a777 100644 --- a/java/common/org/linphone/core/LinphoneCoreListener.java +++ b/java/common/org/linphone/core/LinphoneCoreListener.java @@ -53,15 +53,6 @@ public interface LinphoneCoreListener { */ void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf); - /** - * invoked when a new text message is received - * @param lc LinphoneCore - * @param room LinphoneChatRoom involved in this conversation. Can be be created by the framework in case the from is not present in any chat room. - * @param from LinphoneAddress from - * @param message incoming message - */ - void textReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneAddress from, String message); - /** * invoked when a new dtmf is received * @param lc LinphoneCore diff --git a/java/common/org/linphone/core/LinphoneCoreListenerBase.java b/java/common/org/linphone/core/LinphoneCoreListenerBase.java index 158a871af..a7db59c11 100644 --- a/java/common/org/linphone/core/LinphoneCoreListenerBase.java +++ b/java/common/org/linphone/core/LinphoneCoreListenerBase.java @@ -38,13 +38,6 @@ public class LinphoneCoreListenerBase implements LinphoneCoreListener { } - @Override - public void textReceived(LinphoneCore lc, LinphoneChatRoom cr, - LinphoneAddress from, String message) { - // TODO Auto-generated method stub - - } - @Override public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) { // TODO Auto-generated method stub diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index e0f3882bb..3178e8d66 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -1057,10 +1057,10 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized boolean needsEchoCalibration() { return needsEchoCalibration(nativePtr); } - private native boolean needsEchoCanceler(long ptr); + private native boolean hasBuiltInEchoCanceler(long ptr); @Override - public synchronized boolean needsEchoCanceler() { - return needsEchoCanceler(nativePtr); + public synchronized boolean hasBuiltInEchoCanceler() { + return hasBuiltInEchoCanceler(nativePtr); } private native void declineCall(long coreptr, long callptr, int reason); @Override diff --git a/mediastreamer2 b/mediastreamer2 index 46c025c42..cbdcaacbb 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 46c025c428a0bd7c351258ce0d20d6341e895287 +Subproject commit cbdcaacbb6a4938c2c5997049b4f701c664aa0f1