Commit db7ba693 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Changes regarding mic gain + changes for echo cancelation on Android

parent 90230ecf
......@@ -2091,9 +2091,7 @@ static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){
}
void set_mic_gain_db(AudioStream *st, float gain){
if (st->volsend){
ms_filter_call_method(st->volsend,MS_VOLUME_SET_DB_GAIN,&gain);
}else ms_warning("Could not apply mic gain: gain control wasn't activated.");
audio_stream_set_mic_gain_db(st, gain);
}
void set_playback_gain_db(AudioStream *st, float gain){
......
......@@ -4771,8 +4771,12 @@ bool_t linphone_core_echo_limiter_enabled(const LinphoneCore *lc){
}
static void linphone_core_mute_audio_stream(LinphoneCore *lc, AudioStream *st, bool_t val) {
audio_stream_set_mic_gain(st,
(val==TRUE) ? 0 : pow(10,lc->sound_conf.soft_mic_lev/10));
if (val) {
audio_stream_set_mic_gain(st, 0);
} else {
audio_stream_set_mic_gain_db(st, lc->sound_conf.soft_mic_lev);
}
if ( linphone_core_get_rtp_no_xmit_on_audio_mute(lc) ){
audio_stream_mute_rtp(st,val);
}
......
......@@ -1965,15 +1965,31 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_startEchoCalibration(JNI
}
extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_needsEchoCalibration(JNIEnv *env, jobject thiz, jlong lc){
extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_needsEchoCalibration(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){
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;
}
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) {
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;
}
if (ms_snd_card_get_capabilities(sndcard) & MS_SND_CARD_CAP_BUILTIN_ECHO_CANCELLER) return FALSE;
return TRUE;
}
......
......@@ -1164,6 +1164,12 @@ public interface LinphoneCore {
* If the device has a builtin echo canceller or calibration value is already known, it will return false.
*/
boolean needsEchoCalibration();
/**
* 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();
void enableIpv6(boolean enable);
......
......@@ -1045,6 +1045,11 @@ class LinphoneCoreImpl implements LinphoneCore {
public synchronized boolean needsEchoCalibration() {
return needsEchoCalibration(nativePtr);
}
private native boolean needsEchoCanceler(long ptr);
@Override
public synchronized boolean needsEchoCanceler() {
return needsEchoCanceler(nativePtr);
}
private native void declineCall(long coreptr, long callptr, int reason);
@Override
public synchronized void declineCall(LinphoneCall aCall, Reason reason) {
......
mediastreamer2 @ 2f449777
Subproject commit 8dc83083e8f78ff7466a2611487366af6d00c5f7
Subproject commit 2f4497778b9c106837eb8f2b948be5532224b618
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