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

+11 -1
View File
@@ -40,6 +40,9 @@ export interface PersistedSettings {
voiceTurnTtlSeconds: number | null;
voiceOpusWs: boolean | null;
voiceJitterMaxMs: number | null;
voiceDownlinkFrameMs: 20 | 40 | null;
voiceAssumeCloudflare: boolean | null;
voiceAutoRelayRetry: boolean | null;
relayConfigured: boolean;
relayEnabled: boolean;
relayName: string;
@@ -73,6 +76,9 @@ export interface SettingsUpdate {
voiceTurnTtlSeconds?: number | null;
voiceOpusWs?: boolean | null;
voiceJitterMaxMs?: number | null;
voiceDownlinkFrameMs?: 20 | 40 | null;
voiceAssumeCloudflare?: boolean | null;
voiceAutoRelayRetry?: boolean | null;
relayConfigured: boolean;
relayEnabled: boolean;
relayName: string;
@@ -775,7 +781,7 @@ export class WebSpeakDatabase {
}
/** Optional settings must survive a code-only rollback to the 0.3.3 schema. */
private readVoiceSettings(): Pick<PersistedSettings, "voiceProfile" | "voiceTurnUrls" | "voiceTurnSecretEncrypted" | "voiceTurnTtlSeconds" | "voiceOpusWs" | "voiceJitterMaxMs"> {
private readVoiceSettings(): Pick<PersistedSettings, "voiceProfile" | "voiceTurnUrls" | "voiceTurnSecretEncrypted" | "voiceTurnTtlSeconds" | "voiceOpusWs" | "voiceJitterMaxMs" | "voiceDownlinkFrameMs" | "voiceAssumeCloudflare" | "voiceAutoRelayRetry"> {
let value: Record<string, unknown> = {};
try {
const parsed: unknown = JSON.parse(this.getMeta(VOICE_SETTINGS_META_KEY) ?? "{}");
@@ -791,6 +797,10 @@ export class WebSpeakDatabase {
voiceOpusWs: typeof value.voiceOpusWs === "boolean" ? value.voiceOpusWs : null,
voiceJitterMaxMs: Number.isInteger(value.voiceJitterMaxMs) && Number(value.voiceJitterMaxMs) >= 80 && Number(value.voiceJitterMaxMs) <= 500
? Number(value.voiceJitterMaxMs) : null,
voiceDownlinkFrameMs: value.voiceDownlinkFrameMs === 20 || value.voiceDownlinkFrameMs === 40
? value.voiceDownlinkFrameMs : null,
voiceAssumeCloudflare: typeof value.voiceAssumeCloudflare === "boolean" ? value.voiceAssumeCloudflare : null,
voiceAutoRelayRetry: typeof value.voiceAutoRelayRetry === "boolean" ? value.voiceAutoRelayRetry : null,
};
}