- Added support for Opus Forward Error Correction (FEC) via
Opus Expected Packet Loss configuration variable.
This commit is contained in:
@ -25,6 +25,7 @@ class ConfigActivity : AppCompatActivity() {
|
||||
internal lateinit var caFile: CheckBox
|
||||
internal lateinit var aec: CheckBox
|
||||
internal lateinit var opusBitRate: EditText
|
||||
internal lateinit var opusPacketLoss: EditText
|
||||
internal lateinit var iceLite: CheckBox
|
||||
internal lateinit var debug: CheckBox
|
||||
internal lateinit var reset: CheckBox
|
||||
@ -37,6 +38,7 @@ class ConfigActivity : AppCompatActivity() {
|
||||
private var oldCAFile = false
|
||||
private var oldAec = false
|
||||
private var oldOpusBitrate = ""
|
||||
private var oldOpusPacketLoss = ""
|
||||
private var oldIceMode = ""
|
||||
private var oldLogLevel = ""
|
||||
private var callVolume = BaresipService.callVolume
|
||||
@ -95,6 +97,11 @@ class ConfigActivity : AppCompatActivity() {
|
||||
oldOpusBitrate = if (obCv.size == 0) "28000" else obCv[0]
|
||||
opusBitRate.setText(oldOpusBitrate)
|
||||
|
||||
opusPacketLoss = findViewById(R.id.OpusPacketLoss) as EditText
|
||||
val oplCv = Config.variable("opus_packet_loss")
|
||||
oldOpusPacketLoss = if (oplCv.size == 0) "0" else oplCv[0]
|
||||
opusPacketLoss.setText(oldOpusPacketLoss)
|
||||
|
||||
iceLite = findViewById(R.id.IceLite) as CheckBox
|
||||
val imCv = Config.variable("ice_mode")
|
||||
oldIceMode = if (imCv.size == 0) "full" else imCv[0]
|
||||
@ -277,6 +284,23 @@ class ConfigActivity : AppCompatActivity() {
|
||||
restart = true
|
||||
}
|
||||
|
||||
val opusPacketLoss = opusPacketLoss.text.toString().trim()
|
||||
if (opusPacketLoss != oldOpusPacketLoss) {
|
||||
if (!checkOpusPacketLoss(opusPacketLoss)) {
|
||||
Utils.alertView(this, "Notice",
|
||||
"Invalid Opus Packet Loss Percentage: $opusPacketLoss")
|
||||
return false
|
||||
}
|
||||
Config.remove("opus_inbandfec")
|
||||
Config.remove("opus_packet_loss")
|
||||
if (opusPacketLoss != "0") {
|
||||
Config.add("opus_inbandfec", "yes")
|
||||
Config.add("opus_bitrate", opusPacketLoss)
|
||||
}
|
||||
save = true
|
||||
restart = true
|
||||
}
|
||||
|
||||
var iceModeString = "full"
|
||||
if (iceLite.isChecked) iceModeString = "lite"
|
||||
if (oldIceMode != iceModeString) {
|
||||
@ -357,6 +381,10 @@ class ConfigActivity : AppCompatActivity() {
|
||||
Utils.alertView(this, getString(R.string.opus_bit_rate),
|
||||
getString(R.string.opus_bit_rate_help))
|
||||
}
|
||||
findViewById(R.id.OpusPacketLossTitle) as TextView-> {
|
||||
Utils.alertView(this, getString(R.string.opus_packet_loss),
|
||||
getString(R.string.opus_packet_loss_help))
|
||||
}
|
||||
findViewById(R.id.IceLiteTitle) as TextView-> {
|
||||
Utils.alertView(this, getString(R.string.ice_lite_mode),
|
||||
getString(R.string.ice_lite_mode_help))
|
||||
@ -385,7 +413,13 @@ class ConfigActivity : AppCompatActivity() {
|
||||
private fun checkOpusBitRate(opusBitRate: String): Boolean {
|
||||
val number = opusBitRate.toIntOrNull()
|
||||
if (number == null) return false
|
||||
return (number >=6000) && (number <= 510000)
|
||||
return (number >= 6000) && (number <= 510000)
|
||||
}
|
||||
|
||||
private fun checkOpusPacketLoss(opusPacketLoss: String): Boolean {
|
||||
val number = opusPacketLoss.toIntOrNull()
|
||||
if (number == null) return false
|
||||
return (number >= 0) && (number <= 100)
|
||||
}
|
||||
|
||||
private fun addMissingPorts(addressList: String): String {
|
||||
|
||||
@ -196,11 +196,10 @@
|
||||
</CheckBox>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:orientation="horizontal" >
|
||||
<TextView
|
||||
android:id="@+id/OpusBitRateTitle"
|
||||
@ -228,6 +227,37 @@
|
||||
</EditText>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:orientation="horizontal" >
|
||||
<TextView
|
||||
android:id="@+id/OpusPacketLossTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@android:color/black"
|
||||
android:onClick="onClick"
|
||||
android:text="@string/opus_packet_loss" >
|
||||
</TextView>
|
||||
<EditText
|
||||
android:id="@+id/OpusPacketLoss"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toEndOf="@+id/OpusPacketLossTitle"
|
||||
android:layout_marginStart="10dp"
|
||||
android:textSize="18sp"
|
||||
android:scrollHorizontally="true"
|
||||
android:inputType="numberDecimal"
|
||||
android:hint="@string/_0"
|
||||
android:importantForAutofill="no" >
|
||||
</EditText>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@ -192,6 +192,11 @@
|
||||
keskimääräinen enimmäisnopeus. Mahdollisia arvoja ovat
|
||||
6000-510000. Oletusarvo on 28000.
|
||||
</string>
|
||||
<string name="opus_packet_loss">Odotettu Opus pakettihäviö</string>
|
||||
<string name="opus_packet_loss_help">Odotettu Opus audio virran pakettihäviö prosentteina.
|
||||
Mahdolliset arvot ovat 0-100. Oletusarvo on 0, jolloin ennakoiva virheenkorjaus
|
||||
ei ole käytössä.</string>
|
||||
<string name="_0" translatable="false">0</string>
|
||||
<string name="ice_lite_mode">ICE Lite-moodi</string>
|
||||
<string name="ice_lite_mode_help">Jos merkitty, ICE Lite-moodi on
|
||||
käytössä.
|
||||
|
||||
@ -178,6 +178,11 @@ Check Apps → baresip → Permissions → Storage and that file \'accounts.bs\'
|
||||
<string name="opus_bit_rate_help">Average maximum bit rate used by Opus audio stream.
|
||||
Valid values are 6000-510000. Factory default is 28000.</string>
|
||||
<string name="_28000" translatable="false">28000</string>
|
||||
<string name="opus_packet_loss">Opus Expected Packet Loss</string>
|
||||
<string name="opus_packet_loss_help">Expected Opus audio stream packet loss percentage.
|
||||
Valid values are 0-100. Factory default is 0, which disables Opus Forward Error
|
||||
Correction (FEC).</string>
|
||||
<string name="_0" translatable="false">0</string>
|
||||
<string name="ice_lite_mode">ICE Lite Mode</string>
|
||||
<string name="ice_lite_mode_help">If checked, ICE Lite Mode is used.</string>
|
||||
<string name="default_call_volume">Default Call Volume</string>
|
||||
|
||||
Reference in New Issue
Block a user