- Made Acoustic Echo Cancellation configurable.
- Added module_load/unload functions to API.
This commit is contained in:
@ -1401,3 +1401,19 @@ JNIEXPORT void JNICALL
|
|||||||
Java_com_tutpro_baresip_Api_net_1debug(JNIEnv *env, jobject thiz) {
|
Java_com_tutpro_baresip_Api_net_1debug(JNIEnv *env, jobject thiz) {
|
||||||
net_debug_log();
|
net_debug_log();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_com_tutpro_baresip_Api_module_1load(JNIEnv *env, jobject thiz, jstring javaModule) {
|
||||||
|
const char *native_module = (*env)->GetStringUTFChars(env, javaModule, 0);
|
||||||
|
int result = module_load(native_module);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, javaModule, native_module);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_tutpro_baresip_Api_module_1unload(JNIEnv *env, jobject thiz, jstring javaModule) {
|
||||||
|
const char *native_module = (*env)->GetStringUTFChars(env, javaModule, 0);
|
||||||
|
module_unload(native_module);
|
||||||
|
LOGD("unloaded module %s\n", native_module);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, javaModule, native_module);
|
||||||
|
}
|
||||||
@ -33,5 +33,7 @@ object Api {
|
|||||||
external fun log_level_set(level: Int)
|
external fun log_level_set(level: Int)
|
||||||
external fun dnsc_srv_set(servers: String): Int
|
external fun dnsc_srv_set(servers: String): Int
|
||||||
external fun net_debug()
|
external fun net_debug()
|
||||||
|
external fun module_load(module: String): Int
|
||||||
|
external fun module_unload(module: String)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,8 @@ object Config {
|
|||||||
config = "${config}zrtp_hash yes\n"
|
config = "${config}zrtp_hash yes\n"
|
||||||
write = true
|
write = true
|
||||||
}
|
}
|
||||||
if (!config.contains(Regex("module[ ]+webrtc_aec.so"))) {
|
if (!config.contains(Regex("ausrc_format s16"))) {
|
||||||
config = "${config}ausrc_format s16\nauplay_format s16\nauenc_format s16\naudec_format s16\nmodule webrtc_aec.so\n"
|
config = "${config}ausrc_format s16\nauplay_format s16\nauenc_format s16\naudec_format s16\n"
|
||||||
write = true
|
write = true
|
||||||
}
|
}
|
||||||
if (!config.contains(Regex("module[ ]+g7221.so"))) {
|
if (!config.contains(Regex("module[ ]+g7221.so"))) {
|
||||||
|
|||||||
@ -18,6 +18,7 @@ class ConfigActivity : AppCompatActivity() {
|
|||||||
internal lateinit var listenAddr: EditText
|
internal lateinit var listenAddr: EditText
|
||||||
internal lateinit var preferIPv6: CheckBox
|
internal lateinit var preferIPv6: CheckBox
|
||||||
internal lateinit var dnsServers: EditText
|
internal lateinit var dnsServers: EditText
|
||||||
|
internal lateinit var aec: CheckBox
|
||||||
internal lateinit var opusBitRate: EditText
|
internal lateinit var opusBitRate: EditText
|
||||||
internal lateinit var iceLite: CheckBox
|
internal lateinit var iceLite: CheckBox
|
||||||
internal lateinit var debug: CheckBox
|
internal lateinit var debug: CheckBox
|
||||||
@ -27,6 +28,7 @@ class ConfigActivity : AppCompatActivity() {
|
|||||||
private var oldListenAddr = ""
|
private var oldListenAddr = ""
|
||||||
private var oldPreferIPv6 = ""
|
private var oldPreferIPv6 = ""
|
||||||
private var oldDnsServers = ""
|
private var oldDnsServers = ""
|
||||||
|
private var oldAec = false
|
||||||
private var oldOpusBitrate = ""
|
private var oldOpusBitrate = ""
|
||||||
private var oldIceMode = ""
|
private var oldIceMode = ""
|
||||||
private var oldLogLevel = ""
|
private var oldLogLevel = ""
|
||||||
@ -66,6 +68,11 @@ class ConfigActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
dnsServers.setText(oldDnsServers)
|
dnsServers.setText(oldDnsServers)
|
||||||
|
|
||||||
|
aec = findViewById(R.id.Aec) as CheckBox
|
||||||
|
val aecCv = Config.variable("module")
|
||||||
|
oldAec = aecCv.contains("webrtc_aec.so")
|
||||||
|
aec.isChecked = oldAec
|
||||||
|
|
||||||
opusBitRate = findViewById(R.id.OpusBitRate) as EditText
|
opusBitRate = findViewById(R.id.OpusBitRate) as EditText
|
||||||
val obCv = Config.variable("opus_bitrate")
|
val obCv = Config.variable("opus_bitrate")
|
||||||
oldOpusBitrate = if (obCv.size == 0) "28000" else obCv[0]
|
oldOpusBitrate = if (obCv.size == 0) "28000" else obCv[0]
|
||||||
@ -183,6 +190,21 @@ class ConfigActivity : AppCompatActivity() {
|
|||||||
save = true
|
save = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aec.isChecked != oldAec) {
|
||||||
|
Config.remove("module webrtc_aec.so")
|
||||||
|
if (aec.isChecked) {
|
||||||
|
Config.add("module", "webrtc_aec.so")
|
||||||
|
if (Api.module_load("webrtc_aec.so") != 0) {
|
||||||
|
Utils.alertView(this, "Notice",
|
||||||
|
"Failed to load Acoustic Echo Cancellation module")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Api.module_unload("webrtc_aec.so")
|
||||||
|
}
|
||||||
|
save = true
|
||||||
|
}
|
||||||
|
|
||||||
val opusBitRate = opusBitRate.text.toString().trim()
|
val opusBitRate = opusBitRate.text.toString().trim()
|
||||||
if (opusBitRate != oldOpusBitrate) {
|
if (opusBitRate != oldOpusBitrate) {
|
||||||
if (!checkOpusBitRate(opusBitRate)) {
|
if (!checkOpusBitRate(opusBitRate)) {
|
||||||
@ -258,6 +280,10 @@ class ConfigActivity : AppCompatActivity() {
|
|||||||
Utils.alertView(this, getString(R.string.dns_servers),
|
Utils.alertView(this, getString(R.string.dns_servers),
|
||||||
getString(R.string.dns_servers_help))
|
getString(R.string.dns_servers_help))
|
||||||
}
|
}
|
||||||
|
findViewById(R.id.AecTitle) as TextView-> {
|
||||||
|
Utils.alertView(this, getString(R.string.aec),
|
||||||
|
getString(R.string.aec_help))
|
||||||
|
}
|
||||||
findViewById(R.id.OpusBitRateTitle) as TextView-> {
|
findViewById(R.id.OpusBitRateTitle) as TextView-> {
|
||||||
Utils.alertView(this, getString(R.string.opus_bit_rate),
|
Utils.alertView(this, getString(R.string.opus_bit_rate),
|
||||||
getString(R.string.opus_bit_rate_help))
|
getString(R.string.opus_bit_rate_help))
|
||||||
|
|||||||
@ -112,6 +112,35 @@
|
|||||||
android:importantForAutofill="no" >
|
android:importantForAutofill="no" >
|
||||||
</EditText>
|
</EditText>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/AecTitle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_toStartOf="@id/Aec"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textColor="@android:color/black"
|
||||||
|
android:onClick="onClick"
|
||||||
|
android:text="@string/aec" >
|
||||||
|
</TextView>
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/Aec"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:checked="false" >
|
||||||
|
</CheckBox>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@ -201,6 +201,9 @@
|
|||||||
on IPv6-osoite ja myös portti annetaan, pitää osoite kirjoittaa sulkujen [] sisään.
|
on IPv6-osoite ja myös portti annetaan, pitää osoite kirjoittaa sulkujen [] sisään.
|
||||||
Esimerkiksi luettelo \'8.8.8.8:53,[2001:4860:4860::8888]:53\' osoittaa Googlen julkisiin
|
Esimerkiksi luettelo \'8.8.8.8:53,[2001:4860:4860::8888]:53\' osoittaa Googlen julkisiin
|
||||||
DNS-palvelijoihin.</string>
|
DNS-palvelijoihin.</string>
|
||||||
|
<string name="aec">Akustinen kaiun poisto</string>
|
||||||
|
<string name="aec_help">Jos merkitty, kaikua yritetään poistaa puheluiden aikana. Ei ole tällä
|
||||||
|
hetkellä tuettu opus-koodausta käyttävissä puheluissa.</string>
|
||||||
<string name="opus_bit_rate">Opus-koodekin bittinopeus</string>
|
<string name="opus_bit_rate">Opus-koodekin bittinopeus</string>
|
||||||
<string name="opus_bit_rate_help">Opus-koodekin käyttämä
|
<string name="opus_bit_rate_help">Opus-koodekin käyttämä
|
||||||
keskimääräinen enimmäisnopeus. Mahdollisia arvoja ovat
|
keskimääräinen enimmäisnopeus. Mahdollisia arvoja ovat
|
||||||
|
|||||||
@ -165,7 +165,9 @@
|
|||||||
also port is given, ip must
|
also port is given, ip must
|
||||||
be written inside brackets []. As an example, list \'8.8.8.8:53,[2001:4860:4860::8888]:53\'
|
be written inside brackets []. As an example, list \'8.8.8.8:53,[2001:4860:4860::8888]:53\'
|
||||||
points to IPv4 and IPv6 addresses of public Google DNS servers.</string>
|
points to IPv4 and IPv6 addresses of public Google DNS servers.</string>
|
||||||
<string name="_8_8_8_8_53" translatable="false">8.8.8.8:53</string>
|
<string name="aec">Acoustic Echo Cancellation</string>
|
||||||
|
<string name="aec_help">If checked, echo is tried to cancel during calls. Does not currently
|
||||||
|
apply to calls using opus codec.</string>
|
||||||
<string name="opus_bit_rate">Opus Bit Rate</string>
|
<string name="opus_bit_rate">Opus Bit Rate</string>
|
||||||
<string name="opus_bit_rate_help">Average maximum bit rate used by Opus audio stream.
|
<string name="opus_bit_rate_help">Average maximum bit rate used by Opus audio stream.
|
||||||
Valid value are 6000-510000. Factory default is 28000.</string>
|
Valid value are 6000-510000. Factory default is 28000.</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user