Add voice redundancy and the encoder settings on Android

Redundancy sends every voice packet again, one to four times, 20 to
200 ms apart. Listeners' jitter buffers grow to wait for the copies,
native clients' included, so a lost packet costs nothing while a copy
arrives. With a native client listening over a bursty lossy uplink,
the frames lost to concealment fell from 10% to under 1%.

Android gets the desktop's encoder settings: bitrate, complexity, VBR,
FEC, music codec, and the new redundancy delay and copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-06 20:17:13 +00:00
co-authored by Claude Opus 5.5
parent 6cd75eb1cd
commit c8c54bd381
6 changed files with 120 additions and 1 deletions
@@ -39,6 +39,8 @@ import com.ts3client.config.Settings
import kotlin.math.roundToInt
private val DENOISE_LEVELS = listOf("Off", "6 dB", "12 dB", "18 dB", "21 dB")
private const val MIN_BITRATE_KBITS = 8f
private const val MAX_BITRATE_KBITS = 160f
/** Audio devices, transmission, voice activation, processing and playback. */
@Composable
@@ -51,6 +53,11 @@ fun SoundSettingsScreen(vm: SessionController, onBack: () -> Unit) {
var inputMode by remember { mutableStateOf(settings.inputMode) }
var vadMode by remember { mutableStateOf(settings.vadMode) }
var agc by remember { mutableStateOf(settings.agc) }
var vbr by remember { mutableStateOf(settings.vbr) }
var fec by remember { mutableStateOf(settings.fec) }
var music by remember { mutableStateOf(settings.music) }
var redundancy by remember { mutableStateOf(settings.redundancyDelay) }
var copies by remember { mutableStateOf(settings.redundancyCopies) }
var mutedTalkWarning by remember { mutableStateOf(settings.mutedTalkWarning) }
var threshold by remember { mutableFloatStateOf(settings.vadThresholdDb.toFloat()) }
var inputDevice by remember { mutableStateOf(settings.inputDevice) }
@@ -147,6 +154,36 @@ fun SoundSettingsScreen(vm: SessionController, onBack: () -> Unit) {
}
}
Section("Encoder")
Level("Bitrate", settings.bitrate / 1000f, MIN_BITRATE_KBITS..MAX_BITRATE_KBITS, { "${it.roundToInt()} kbit/s" }) {
change { bitrate = it.roundToInt() * 1000 }
}
Level("Complexity", settings.complexity.toFloat(), 0f..10f, { "${it.roundToInt()}" }, steps = 9) {
change { complexity = it.roundToInt() }
}
Toggle("Variable bitrate (VBR)", vbr) {
vbr = it
change { this.vbr = it }
}
Toggle("Forward error correction (FEC)", fec) {
fec = it
change { this.fec = it }
}
Toggle("Music codec (stereo, higher fidelity)", music) {
music = it
change { this.music = it }
}
Picker("Redundancy", Settings.REDUNDANCY_DELAYS.map { it to if (it == 0) "Off" else "$it ms" }, redundancy) {
redundancy = it
change { redundancyDelay = it }
}
if (redundancy > 0) {
Picker("Copies", (1..Settings.MAX_REDUNDANCY_COPIES).map { it to "$it" }, copies) {
copies = it
change { redundancyCopies = it }
}
}
Section("Playback")
Level("Volume", settings.outputVolume.toFloat(), 0f..2f, { "${(it * 100).roundToInt()} %" }) {
change { outputVolume = it.toDouble() }