feat(voice): harden tunnel fallback and add tuning controls

Add v3 batched downlink with tick-aligned timestamps, audio-clock playback and PLC; add adaptive Opus/PCM uplink and one-shot TURN relay retry. Expose frame size, automatic relay retry and Cloudflare ingress assumptions in the admin console, with persistence, i18n, docs and regression tests.
This commit is contained in:
LabKit committed 2026-12-03 02:40:19 +08:00
1 parent 001457d004
commit de16417474
44 files changed
+1605 -192

No files matched your search

@@ -16,11 +16,12 @@ function emptyForm() {
accessMode: "fixed" as "fixed" | "open", siteName: "WebSpeak", welcomeText: "", welcomeTextEn: "", welcomeTextDe: "", welcomeTextRu: "", welcomeTextJa: "",
welcomeDefaults: { ...DEFAULT_WELCOME_TEXTS }, webRtcPublicHost: "", webRtcIpv6Enabled: false, webRtcStunServer: "", webRtcEnabled: false, webRtcUdpStart: 40000, webRtcUdpEnd: 40099,
voiceProfile: "auto" as "auto" | "legacy" | "adaptive", voiceTurnUrls: "", voiceTurnSecret: "", voiceTurnSecretAction: "keep" as SecretAction,
hasVoiceTurnSecret: false, voiceTurnTtlSeconds: 21600, voiceOpusWs: false, voiceJitterMaxMs: 300,
hasVoiceTurnSecret: false, voiceTurnTtlSeconds: 21600, voiceOpusWs: true, voiceJitterMaxMs: 300,
voiceDownlinkFrameMs: 20 as 20 | 40, voiceAssumeCloudflare: false, voiceAutoRelayRetry: true,
relayNodes: [] as RelayNodeForm[], lastTestAt: null as string | null, lastTestLatencyMs: null as number | null };
}
type ServerForm = ReturnType<typeof emptyForm>;
const editable = ["address", "port", "accessMode", "siteName", "welcomeText", "welcomeTextEn", "welcomeTextDe", "welcomeTextRu", "welcomeTextJa", "webRtcEnabled", "webRtcPublicHost", "webRtcIpv6Enabled", "webRtcStunServer", "webRtcUdpStart", "webRtcUdpEnd", "voiceProfile", "voiceTurnUrls", "voiceTurnTtlSeconds", "voiceOpusWs", "voiceJitterMaxMs"] as const;
const editable = ["address", "port", "accessMode", "siteName", "welcomeText", "welcomeTextEn", "welcomeTextDe", "welcomeTextRu", "welcomeTextJa", "webRtcEnabled", "webRtcPublicHost", "webRtcIpv6Enabled", "webRtcStunServer", "webRtcUdpStart", "webRtcUdpEnd", "voiceProfile", "voiceTurnUrls", "voiceTurnTtlSeconds", "voiceOpusWs", "voiceJitterMaxMs", "voiceDownlinkFrameMs", "voiceAssumeCloudflare", "voiceAutoRelayRetry"] as const;
const snapshot = (form: ServerForm): ServerForm => JSON.parse(JSON.stringify(form));
export function useAdminServerSettings(options: Options) {
@@ -116,7 +117,7 @@ export function useAdminServerSettings(options: Options) {
relayNodes: serverForm.relayNodes.map(node => ({ id: node.id, name: node.name, target: node.target, voiceEndpoint: node.voiceEndpoint, enabled: node.enabled, tokenAction: node.tokenAction, ...(node.tokenAction === "replace" ? { token: node.token } : {}) })) };
const saved = savedSettings.value;
if (saved) {
for (const key of ["voiceProfile", "voiceTurnUrls", "voiceTurnTtlSeconds", "voiceOpusWs", "voiceJitterMaxMs"] as const) {
for (const key of ["voiceProfile", "voiceTurnUrls", "voiceTurnTtlSeconds", "voiceOpusWs", "voiceJitterMaxMs", "voiceDownlinkFrameMs", "voiceAssumeCloudflare", "voiceAutoRelayRetry"] as const) {
if (serverForm[key] !== saved[key]) Object.assign(payload, { [key]: serverForm[key] });
}
}