sal_eXosip2_sdp.c \
offeranswer.c \
callbacks.c \
- linphonecall.c
+ linphonecall.c \
+ ec-calibrator.c
LOCAL_CFLAGS += \
-D_BYTE_ORDER=_LITTLE_ENDIAN \
ecc->play=ms_filter_new(MS_FILE_PLAYER_ID);
ecc->gen=ms_filter_new(MS_DTMF_GEN_ID);
+ ecc->resampler=ms_filter_new(MS_RESAMPLE_ID);
ecc->sndwrite=ms_snd_card_create_writer(ecc->capt_card);
ms_filter_link(ecc->play,0,ecc->gen,0);
- ms_filter_link(ecc->gen,0,ecc->sndwrite,0);
+ ms_filter_link(ecc->gen,0,ecc->resampler,0);
+ ms_filter_link(ecc->resampler,0,ecc->sndwrite,0);
+ unsigned int rate;
+ ms_filter_call_method(ecc->sndwrite,MS_FILTER_GET_SAMPLE_RATE,&rate);
+ ms_filter_call_method(ecc->resampler,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&rate);
ms_ticker_attach(ecc->ticker,ecc->play);
ms_ticker_attach(ecc->ticker,ecc->sndread);
ms_ticker_detach(ecc->ticker,ecc->sndread);
ms_filter_unlink(ecc->play,0,ecc->gen,0);
- ms_filter_unlink(ecc->gen,0,ecc->sndwrite,0);
+ ms_filter_unlink(ecc->gen,0,ecc->resampler,0);
+ ms_filter_unlink(ecc->resampler,0,ecc->sndwrite,0);
ms_filter_unlink(ecc->sndread,0,ecc->det,0);
ms_filter_unlink(ecc->det,0,ecc->rec,0);
ms_filter_destroy(ecc->rec);
ms_filter_destroy(ecc->play);
ms_filter_destroy(ecc->gen);
+ ms_filter_destroy(ecc->resampler);
ms_filter_destroy(ecc->sndwrite);
ms_ticker_destroy(ecc->ticker);
ecc_init_filters(ecc);
ecc_play_tones(ecc);
ecc_deinit_filters(ecc);
+ ms_thread_exit(NULL);
return NULL;
}
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneCore;
+import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
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 ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {}
TutorialNotifier.notify(s);
}
+
+
}
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneCore;
+import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,String url) {}
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {}
public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg){}
-
+ public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {}
public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {
TutorialNotifier.notify(s);
}
+
}
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneCore;
+import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
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 ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {}
/*
* Call state notification listener
*/
TutorialNotifier.notify(s);
}
+
}
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneCore;
+import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener;
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 ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {}
public static void main(String[] args) {
// Check tutorial was called with the right number of arguments
TutorialNotifier.notify(s);
}
+
+
}
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <jni.h>
-#include "linphonecore.h"
+#include "linphonecore_utils.h"
+
#include "mediastreamer2/msjava.h"
#ifdef ANDROID
callStateId = env->GetMethodID(listernerClass,"callState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneCall$State;Ljava/lang/String;)V");
callStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCall$State"));
callStateFromIntId = env->GetStaticMethodID(callStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCall$State;");
-
+ /*void ecCalibrationStatus(LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data);*/
+ ecCalibrationStatusId = env->GetMethodID(listernerClass,"ecCalibrationStatus","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$EcCalibratorStatus;ILjava/lang/Object;)V");
+ ecCalibratorStatusClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$EcCalibratorStatus"));
+ ecCalibratorStatusFromIntId = env->GetStaticMethodID(ecCalibratorStatusClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$EcCalibratorStatus;");
/*void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url)*/
newSubscriptionRequestId = env->GetMethodID(listernerClass,"newSubscriptionRequest","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;Ljava/lang/String;)V");
jmethodID callStateId;
jmethodID callStateFromIntId;
+ jclass ecCalibratorStatusClass;
+ jmethodID ecCalibrationStatusId;
+ jmethodID ecCalibratorStatusFromIntId;
+
jclass proxyClass;
jmethodID proxyCtrId;
,env->NewObject(lcData->addressClass,lcData->addressCtrId,(jlong)from)
,message ? env->NewStringUTF(message) : NULL);
}
+ static void ecCalibrationStatus(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data) {
+ JNIEnv *env = 0;
+ jint result = jvm->AttachCurrentThread(&env,NULL);
+ if (result != 0) {
+ ms_error("cannot attach VM\n");
+ return;
+ }
+ LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
+ env->CallVoidMethod(lcData->listener
+ ,lcData->ecCalibrationStatusId
+ ,lcData->core
+ ,env->CallStaticObjectMethod(lcData->ecCalibratorStatusClass,lcData->ecCalibratorStatusFromIntId,(jint)status)
+ ,delay_ms
+ ,data ? data : NULL);
+ if (data != NULL &&status !=LinphoneEcCalibratorInProgress ) {
+ //final state, releasing global ref
+ env->DeleteGlobalRef((jobject)data);
+ }
+
+ }
};
return linphone_core_keep_alive_enabled((LinphoneCore*)lc);
}
+extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_startEchoCalibration(JNIEnv* env
+ ,jobject thiz
+ ,jlong lc
+ ,jobject data) {
+ return linphone_core_start_echo_calibration((LinphoneCore*)lc
+ , LinphoneCoreData::ecCalibrationStatus
+ , data?env->NewGlobalRef(data):NULL);
+
+}
+
+
+
//ProxyConfig
extern "C" jlong Java_org_linphone_core_LinphoneProxyConfigImpl_newLinphoneProxyConfig(JNIEnv* env,jobject thiz) {
#else
#include "linphone/linphonecore.h"
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
typedef struct _LsdPlayer LsdPlayer;
typedef struct _LinphoneSoundDaemon LinphoneSoundDaemon;
* Start an echo calibration of the sound devices, in order to find adequate settings for the echo canceller automatically.
**/
int linphone_core_start_echo_calibration(LinphoneCore *lc, LinphoneEcCalibrationCallback cb, void *cb_data);
-
+#ifdef __cplusplus
+}
+#endif
#endif
ms_thread_t thread;
MSSndCard *play_card,*capt_card;
MSFilter *sndread,*det,*rec;
- MSFilter *play, *gen, *sndwrite;
+ MSFilter *play, *gen, *sndwrite,*resampler;
MSTicker *ticker;
LinphoneEcCalibrationCallback cb;
void *cb_data;
return mStringValue;
}
}
+ /**
+ * EC Calibrator Status
+.
+ *
+ */
+ static public class EcCalibratorStatus {
+
+ static private Vector values = new Vector();
+ /**
+ * Calibration in progress
+ */
+ static public EcCalibratorStatus InProgress = new EcCalibratorStatus(0,"InProgress");
+ /**
+ * Calibration done
+ */
+ static public EcCalibratorStatus Done = new EcCalibratorStatus(1,"Done");
+ /**
+ * Calibration in progress
+ */
+ static public EcCalibratorStatus Failed = new EcCalibratorStatus(2,"Failed");
+
+ private final int mValue;
+ private final String mStringValue;
+
+ private EcCalibratorStatus(int value,String stringValue) {
+ mValue = value;
+ values.addElement(this);
+ mStringValue=stringValue;
+ }
+ public static EcCalibratorStatus fromInt(int value) {
+
+ for (int i=0; i<values.size();i++) {
+ EcCalibratorStatus status = (EcCalibratorStatus) values.elementAt(i);
+ if (status.mValue == value) return status;
+ }
+ throw new RuntimeException("status not found ["+value+"]");
+ }
+ public String toString() {
+ return mStringValue;
+ }
+ public int value(){
+ return mValue;
+ }
+ }
/**
* clear all added proxy configs
*/
* @return true if enable
*/
boolean isKeepAliveEnabled();
+ /**
+ * Start an echo calibration of the sound devices, in order to find adequate settings for the echo canceler automatically.
+ * status is notified to {@link LinphoneCoreListener#ecCalibrationStatus(EcCalibratorStatus, int, Object)}
+ * @param User object
+ * @throws LinphoneCoreException if operation is still in progress;
+ **/
+ void startEchoCalibration(Object data) throws LinphoneCoreException;
}
* @param message incoming message
*/
public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message);
+ /**
+ * Invoked when echo cancalation calibration is completed
+ * @param lc LinphoneCore
+ * @param status
+ * @param delay_ms echo delay
+ * @param data
+ */
+ void ecCalibrationStatus(LinphoneCore lc,LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data);
+
}
-Subproject commit 434b627405d46c50cb109c001e44891551d0efab
+Subproject commit a4f5a5bcf16ec4deec210bbd021952495a14d055