- Added to Settings possibility to choose which audio modules are loaded.

Codecs provided by loaded modules are available for accounts to use.
This commit is contained in:
Juha Heinanen
2019-10-22 17:33:46 +03:00
parent cf3e02c46d
commit 53f751454d
9 changed files with 178 additions and 69 deletions
@@ -1,6 +1,8 @@
package com.tutpro.baresip
import android.content.Context
import java.util.*
import kotlin.collections.ArrayList
class Account(val accp: String) {
@@ -151,6 +153,27 @@ class Account(val accp: String) {
return aor.split("@")[1]
}
private fun removeAudioCodecsStartingWith(prefix: String) {
val newCodecs = ArrayList<String>()
for (acSpec in audioCodec)
if (!acSpec.toLowerCase(Locale.ROOT).startsWith(prefix)) newCodecs.add(acSpec)
audioCodec = newCodecs
}
fun removeAudioCodecs(codecModule: String) {
when (codecModule) {
"g711" -> {
removeAudioCodecsStartingWith("pcm")
}
"g722" -> {
removeAudioCodecsStartingWith("g722/")
}
else -> {
removeAudioCodecsStartingWith(codecModule)
}
}
}
companion object {
fun accounts(): ArrayList<Account> {