When aec is enabled/disabled, load/unload webrtc_aecm module

Module webrtc_aecm does not have extended filter
This commit is contained in:
Juha Heinanen
2021-10-28 19:47:45 +03:00
parent bc7be1ff49
commit 6c1ddca09f
3 changed files with 6 additions and 50 deletions

View File

@ -83,13 +83,9 @@ class AudioActivity : AppCompatActivity() {
aec = binding.Aec
val aecCv = Config.variable("module")
oldAec = aecCv.contains("webrtc_aec.so")
oldAec = aecCv.contains("webrtc_aecm.so")
aec.isChecked = oldAec
extendedFilter = binding.ExtendedFilter
oldExtendedFilter = Config.variable("webrtc_aec_extended_filter")[0] == "yes"
extendedFilter.isChecked = oldExtendedFilter
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
@ -163,31 +159,21 @@ class AudioActivity : AppCompatActivity() {
}
if (aec.isChecked != oldAec) {
Config.removeLine("module webrtc_aec.so")
Config.removeLine("module webrtc_aecm.so")
if (aec.isChecked) {
Config.addModuleLine("module webrtc_aec.so")
if (Api.module_load("webrtc_aec.so") != 0) {
Config.addModuleLine("module webrtc_aecm.so")
if (Api.module_load("webrtc_aecm.so") != 0) {
Utils.alertView(this, getString(R.string.error),
getString(R.string.failed_to_load_module))
aec.isChecked = false
return false
}
} else {
Api.module_unload("webrtc_aec.so")
Api.module_unload("webrtc_aecm.so")
}
save = true
}
if (extendedFilter.isChecked != oldExtendedFilter) {
Config.removeVariable("webrtc_aec_extended_filter")
if (extendedFilter.isChecked)
Config.addLine("webrtc_aec_extended_filter yes")
else
Config.addLine("webrtc_aec_extended_filter no")
reload = true
save = true
}
if (save) Config.save()
if (reload) Api.reload_config()
@ -232,10 +218,6 @@ class AudioActivity : AppCompatActivity() {
Utils.alertView(this, getString(R.string.aec),
getString(R.string.aec_help))
}
binding.ExtendedFilterTitle -> {
Utils.alertView(this, getString(R.string.aec_extended_filter),
getString(R.string.aec_extended_filter_help))
}
}
}

View File

@ -18,7 +18,7 @@ object Config {
config = config.replace("webrtc_aec.so", "webrtc_aecm.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\nmodule webrtc_aecm.so\n"
}
if (config.contains(Regex("#module_app[ ]+mwi.so"))) {

View File

@ -123,32 +123,6 @@
</CheckBox>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp" >
<TextView
android:id="@+id/ExtendedFilterTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/ExtendedFilter"
android:textSize="18sp"
android:onClick="onClick"
android:text="@string/aec_extended_filter" >
</TextView>
<CheckBox
android:id="@+id/ExtendedFilter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_gravity="end"
android:checked="true" >
</CheckBox>
</RelativeLayout>
</LinearLayout>
</ScrollView>