Commit e0e2e3e7 authored by jehan's avatar jehan

add EC bypass mode

parent fa1e4658
......@@ -572,6 +572,7 @@ static void rendercb(void *data, const MSPicture *local, const MSPicture *remote
}
#endif
void linphone_call_init_media_streams(LinphoneCall *call){
LinphoneCore *lc=call->core;
SalMediaDescription *md=call->localdesc;
......@@ -672,30 +673,24 @@ static void post_configure_audio_streams(LinphoneCall*call){
}
if (st->volsend){
ms_filter_call_method(st->volsend,MS_VOLUME_REMOVE_DC,&dc_removal);
}
if (linphone_core_echo_limiter_enabled(lc)){
float speed=lp_config_get_float(lc->config,"sound","el_speed",-1);
thres=lp_config_get_float(lc->config,"sound","el_thres",-1);
float force=lp_config_get_float(lc->config,"sound","el_force",-1);
int sustain=lp_config_get_int(lc->config,"sound","el_sustain",-1);
float transmit_thres=lp_config_get_float(lc->config,"sound","el_transmit_thres",-1);
MSFilter *f=NULL;
if (st->el_type!=ELInactive){
f=st->volsend;
if (speed==-1) speed=0.03;
if (force==-1) force=25;
ms_filter_call_method(f,MS_VOLUME_SET_EA_SPEED,&speed);
ms_filter_call_method(f,MS_VOLUME_SET_EA_FORCE,&force);
if (thres!=-1)
ms_filter_call_method(f,MS_VOLUME_SET_EA_THRESHOLD,&thres);
if (sustain!=-1)
ms_filter_call_method(f,MS_VOLUME_SET_EA_SUSTAIN,&sustain);
if (transmit_thres!=-1)
f=st->volsend;
if (speed==-1) speed=0.03;
if (force==-1) force=25;
ms_filter_call_method(f,MS_VOLUME_SET_EA_SPEED,&speed);
ms_filter_call_method(f,MS_VOLUME_SET_EA_FORCE,&force);
if (thres!=-1)
ms_filter_call_method(f,MS_VOLUME_SET_EA_THRESHOLD,&thres);
if (sustain!=-1)
ms_filter_call_method(f,MS_VOLUME_SET_EA_SUSTAIN,&sustain);
if (transmit_thres!=-1)
ms_filter_call_method(f,MS_VOLUME_SET_EA_TRANSMIT_THRESHOLD,&transmit_thres);
}
}
if (st->volsend){
ms_filter_call_method(st->volsend,MS_VOLUME_SET_NOISE_GATE_THRESHOLD,&ng_thres);
ms_filter_call_method(st->volsend,MS_VOLUME_SET_NOISE_GATE_FLOORGAIN,&ng_floorgain);
}
......@@ -982,3 +977,42 @@ void linphone_call_send_vfu_request(LinphoneCall *call)
sal_call_send_vfu_request(call->op);
}
#endif
void linphone_call_enable_echo_cancellation(LinphoneCall *call, bool_t enable) {
if (call!=NULL && call->audiostream!=NULL && call->audiostream->ec){
bool_t bypass_mode = !enable;
ms_filter_call_method(call->audiostream->ec,MS_ECHO_CANCELLER_SET_BYPASS_MODE,&bypass_mode);
}
}
bool_t linphone_call_echo_cancellation_enabled(LinphoneCall *call) {
if (call!=NULL && call->audiostream!=NULL && call->audiostream->ec){
bool_t val;
ms_filter_call_method(call->audiostream->ec,MS_ECHO_CANCELLER_GET_BYPASS_MODE,&val);
return !val;
} else {
return linphone_core_echo_cancellation_enabled(call->core);
}
}
void linphone_call_enable_echo_limiter(LinphoneCall *call, bool_t val){
if (call!=NULL && call->audiostream!=NULL ) {
if (val) {
const char *type=lp_config_get_string(call->core->config,"sound","el_type","mic");
if (strcasecmp(type,"mic")==0)
audio_stream_enable_echo_limiter(call->audiostream,ELControlMic);
else if (strcasecmp(type,"full")==0)
audio_stream_enable_echo_limiter(call->audiostream,ELControlFull);
} else {
audio_stream_enable_echo_limiter(call->audiostream,ELInactive);
}
}
}
bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call){
if (call!=NULL && call->audiostream!=NULL ){
return call->audiostream->el_type !=ELInactive ;
} else {
return linphone_core_echo_limiter_enabled(call->core);
}
}
......@@ -2894,7 +2894,7 @@ const char * linphone_core_get_ringback(const LinphoneCore *lc){
}
/**
* Enables or disable echo cancellation.
* Enables or disable echo cancellation. Value is saved an used for subsequent calls
*
* @ingroup media_parameters
**/
......@@ -2904,6 +2904,7 @@ void linphone_core_enable_echo_cancellation(LinphoneCore *lc, bool_t val){
lp_config_set_int(lc->config,"sound","echocancellation",val);
}
/**
* Returns TRUE if echo cancellation is enabled.
*
......
......@@ -247,8 +247,34 @@ LinphoneReason linphone_call_get_reason(const LinphoneCall *call);
const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
void *linphone_call_get_user_pointer(LinphoneCall *call);
void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
/**
* Enables or disable echo cancellation for this call
* @param call
* @param val
*
* @ingroup media_parameters
**/
void linphone_call_enable_echo_cancellation(LinphoneCall *call, bool_t val) ;
/**
* Returns TRUE if echo cancellation is enabled.
*
* @ingroup media_parameters
**/
bool_t linphone_call_echo_cancellation_enabled(LinphoneCall *lc);
/**
* Enables or disable echo limiter for this call
* @param call
* @param val
*
* @ingroup media_parameters
**/
void linphone_call_enable_echo_limiter(LinphoneCall *call, bool_t val);
/**
* Returns TRUE if echo limiter is enabled.
*
* @ingroup media_parameters
**/
bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call);
/**
* @addtogroup proxies
* @{
......
......@@ -857,6 +857,7 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCallLogImpl_isIncoming(JNIEnv
return ((LinphoneCallLog*)ptr)->dir==LinphoneCallIncoming?JNI_TRUE:JNI_FALSE;
}
/*payloadType*/
extern "C" jstring Java_org_linphone_core_PayloadTypeImpl_toString(JNIEnv* env,jobject thiz,jlong ptr) {
PayloadType* pt = (PayloadType*)ptr;
char* value = ms_strdup_printf("[%s] clock [%i], bitrate [%i]"
......@@ -913,6 +914,30 @@ extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getState( JNIEnv* env
,jlong ptr) {
return (jint)linphone_call_get_state((LinphoneCall*)ptr);
}
extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableEchoCancellation( JNIEnv* env
,jobject thiz
,jlong ptr
,jboolean value) {
linphone_call_enable_echo_cancellation((LinphoneCall*)ptr,value);
}
extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isEchoCancellationEnabled( JNIEnv* env
,jobject thiz
,jlong ptr) {
return linphone_call_echo_cancellation_enabled((LinphoneCall*)ptr);
}
extern "C" void Java_org_linphone_core_LinphoneCallImpl_enableEchoLimiter( JNIEnv* env
,jobject thiz
,jlong ptr
,jboolean value) {
linphone_call_enable_echo_limiter((LinphoneCall*)ptr,value);
}
extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isEchoLimiterEnabled( JNIEnv* env
,jobject thiz
,jlong ptr) {
return linphone_call_echo_limiter_enabled((LinphoneCall*)ptr);
}
//LinphoneFriend
extern "C" long Java_org_linphone_core_LinphoneFriendImpl_newLinphoneFriend(JNIEnv* env
......
......@@ -21,7 +21,7 @@ package org.linphone.core;
import java.util.Vector;
/**
* Object representing a Call. calls are created using {@link LinphoneCore#invite(LinphoneAddress)} or paased to the application by listener {@link LinphoneCoreListener#callState(LinphoneCore, LinphoneCall, State, String)}
* Object representing a Call. calls are created using {@link LinphoneCore#invite(LinphoneAddress)} or passed to the application by listener {@link LinphoneCoreListener#callState(LinphoneCore, LinphoneCall, State, String)}
*
*/
@SuppressWarnings("unchecked")
......@@ -154,5 +154,25 @@ public interface LinphoneCall {
public LinphoneCallParams getCurrentParamsCopy();
public void enableCamera(boolean enabled);
/**
* Enables or disable echo cancellation.
* @param enable
*/
public void enableEchoCancellation(boolean enable);
/**
* get EC status
* @return true if echo cancellation is enabled.
*/
public boolean isEchoCancellationEnabled();
/**
* Enables or disable echo limiter cancellation.
* @param enable
*/
public void enableEchoLimiter(boolean enable);
/**
* get EL status
* @return true if echo limiter is enabled.
*/
public boolean isEchoLimiterEnabled();
}
mediastreamer2 @ d4829668
Subproject commit 11a2eced2d238322c32fc775a6583387a9d43fc4
Subproject commit d48296689764e1f5f27f16c881ee4c5dcb8445dd
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment