mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-11-30 18:42:49 +08:00
fix: validate merged voice fallback and host toolbar features
This commit is contained in:
1 parent
02509ea551
commit
001457d004
32 files changed
+319
-102
No files matched your search
@@ -183,9 +183,9 @@ legacy 分支:
|
||||
`WEBSPEAK_VOICE_ICE_TRANSPORT_POLICY` 改成 `relay`,那会掩盖直连问题。
|
||||
- 媒体地址配置错误时,先清空管理台“公网媒体地址”并确认非 Cloudflare
|
||||
直连入口,再检查防火墙;Cloudflare 请求下留空会禁用直连,需要 TURN。
|
||||
- 数据库结构升级:本构建首次启动会把数据库迁移到 schema 14。旧版本二进制
|
||||
会拒绝 schema 14,因此回退二进制前必须先恢复升级前的数据库备份及对应的
|
||||
`master.key`;只回退代码、保留 schema 14 数据库会导致旧版本无法启动。
|
||||
- 语音覆盖配置保存在现有 metadata 表,数据库保持 schema 13;TURN 密钥仍加密。
|
||||
回退到 0.3.3 时旧程序会忽略新增元数据,不影响启动,也不会清除这些配置。
|
||||
自动更新失败时可以继续使用现有代码回滚流程,无需降级数据库。
|
||||
|
||||
## 5. 已知限制
|
||||
|
||||
|
||||
@@ -73,11 +73,9 @@ WEBSPEAK_TURN_REST_TTL_SECONDS=21600
|
||||
|
||||
## 数据库与回滚
|
||||
|
||||
- 本构建把数据库迁移到 schema 14。schema 13→14 只新增可空的语音覆盖列,
|
||||
现有行继续继承环境变量;新数据库仍从 schema 1 顺序迁移。
|
||||
- 旧版本二进制会拒绝 schema 14。升级前应备份数据库及对应的 `master.key`;
|
||||
回退二进制时必须恢复匹配的备份。只回退代码而保留 schema 14 数据库会导致
|
||||
旧版本无法启动。
|
||||
- 语音覆盖配置写入现有 metadata 表,数据库保持 schema 13;未设置的值继承
|
||||
环境变量,TURN 密钥继续加密保存。
|
||||
- 0.3.3 会忽略并保留这些元数据,可以在自动更新健康检查失败后直接恢复旧代码。
|
||||
- 恢复非 Cloudflare 旧音频行为:选择 `legacy`,或确保没有控制台覆盖后设置
|
||||
`WEBSPEAK_VOICE_PROFILE=legacy`。
|
||||
- 关闭 Opus:取消控制台选项或设置 `WEBSPEAK_VOICE_OPUS_WS=0`。
|
||||
|
||||
@@ -12,12 +12,12 @@ A minimal schema v3 open skin that docks the trusted recovery entry into the pag
|
||||
|
||||
```text
|
||||
host-chrome-toolbar/
|
||||
manifest.json # schema v3, version 1.1.1, minAppVersion 0.3.3, author WebSpeak Community
|
||||
manifest.json # schema v3, version 1.1.2, minAppVersion 0.3.4-dev.0, author WebSpeak Community
|
||||
chrome.json # one grouped toolbar slot with a home/voice anchor list
|
||||
skin.css # light page theme, Classic toolbar tokens and header space
|
||||
```
|
||||
|
||||
This package requires WebSpeak 0.3.3. WebSpeak 0.3.2 does not accept `mode`, `appearance`, or anchor candidate arrays, so importing it there cannot provide toolbar-mode behavior. Older slots without those fields remain valid and keep their capsule presentation.
|
||||
This package requires WebSpeak 0.3.4-dev.0 or later. Released WebSpeak 0.3.3 and earlier do not accept `mode`, `appearance`, or anchor candidate arrays, so importing it there cannot provide toolbar-mode behavior. Older slots without those fields remain valid and keep their capsule presentation.
|
||||
|
||||
`skin.css` uses only public `data-ws-part` hooks and sets `--skin-host-toolbar-*` / `--skin-recovery-toolbar-*` variables. It never targets the host toolbar DOM, the recovery capsule, the authorization dialog or the load-failure banner.
|
||||
|
||||
|
||||
Binary file not shown.
@@ -3,11 +3,11 @@
|
||||
"packageType": "open-skin",
|
||||
"id": "community.host-chrome-toolbar",
|
||||
"name": "Host Chrome Toolbar",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"author": "WebSpeak Community",
|
||||
"license": "AGPL-3.0-only",
|
||||
"description": "Minimal open skin that docks Classic-aligned host-owned recovery icons into the page header.",
|
||||
"entry": "skin.css",
|
||||
"chrome": "chrome.json",
|
||||
"minAppVersion": "0.3.3"
|
||||
"minAppVersion": "0.3.4-dev.0"
|
||||
}
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "webspeak-android-gateway",
|
||||
"version": "0.3.3",
|
||||
"version": "0.3.4-dev.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "webspeak-android-gateway",
|
||||
"version": "0.3.3",
|
||||
"version": "0.3.4-dev.0",
|
||||
"dependencies": {
|
||||
"@honeybbq/teamspeak": "1.0.0-beta.23",
|
||||
"express": "^4.21.2",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "webspeak-android-gateway",
|
||||
"version": "0.3.3",
|
||||
"version": "0.3.4-dev.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "index.cjs",
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "webspeak-webclient",
|
||||
"version": "0.3.3",
|
||||
"version": "0.3.4-dev.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "webspeak-webclient",
|
||||
"version": "0.3.3",
|
||||
"version": "0.3.4-dev.0",
|
||||
"license": "AGPL-3.0-only",
|
||||
"dependencies": {
|
||||
"@discordjs/opus": "^0.10.0",
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "webspeak-webclient",
|
||||
"version": "0.3.3",
|
||||
"version": "0.3.4-dev.0",
|
||||
"private": true,
|
||||
"license": "AGPL-3.0-only",
|
||||
"type": "module",
|
||||
@@ -11,7 +11,7 @@
|
||||
"scripts": {
|
||||
"dev": "tsx src/index.ts",
|
||||
"build": "tsc",
|
||||
"test": "node --import tsx --test src/admin/security-boundaries.test.ts src/admin/update-routes.test.ts src/updater/version.test.ts src/updater/deployment.test.ts src/updater/archive.test.ts src/updater/code-swap.test.ts src/updater/update-state.test.ts src/updater/update-service.test.ts src/updater/restart-runner.test.ts src/updater/swap-recovery.test.ts src/domain/teamspeak-target.test.ts web/src/voice/member-volume-preferences.test.ts web/src/services/voice-channel-tree.test.ts src/admin/skin-registry.test.ts web/test/skin-store.test.ts src/admin/ts-admin-service.test.ts web/test/admin-api.integration.test.ts web/test/admin-view.test.mjs web/src/services/admin-api.test.ts src/security/open-target-policy.test.ts scripts/acceleration-poc/target-guard-parity.test.mjs src/server/acceleration-relay.test.ts src/server/visitor-count.test.ts src/server/voice-gateway-auth.test.ts src/server/voice-gateway.test.ts src/server/relay-delegation.integration.test.ts src/persistence/database.test.ts src/server/voice-protocol.test.ts src/server/teamspeak-resolver.test.ts src/server/teamspeak-adapter.test.ts src/server/teamspeak-sdk.test.ts src/server/ts-client.test.ts src/server/join-ticket.test.ts src/server/identity-lease.test.ts src/server/session-manager.test.ts src/server/directory-sync.test.ts src/server/session-events.test.ts src/server/reconnect-policy.test.ts src/server/voice-commands.test.ts src/server/voice-bridge.test.ts src/server/session-audio.test.ts src/server/voice-bridge.integration.test.ts src/server/webrtc-audio.test.ts src/server/webrtc-config.test.ts src/server/audio-stats.test.ts src/server/turn-credentials.test.ts src/server/voice-ice-config.test.ts src/server/audio-pacer.test.ts src/server/channel-capacity.test.ts src/server/directory-view.test.ts src/server/member-avatars.test.ts src/server/screen-share-coordinator.test.ts src/shared/client-commands.test.ts src/shared/skin-layout.test.ts src/shared/skin-css.test.ts src/shared/skin-plugin.test.ts src/shared/skin-runtime-plugin-context.test.ts src/shared/skin-runtime-plugins.test.ts src/shared/skin-runtime-plugin-approval.test.ts src/shared/server-messages.test.ts src/shared/voice-ice.test.ts src/shared/voice-profile.test.ts src/shared/webrtc.test.ts scripts/docker-healthcheck.test.mjs web/test/voice-session.test.mjs web/test/audio-controls.test.mjs web/test/connection-dialogs.test.mjs web/test/voice-workspace.test.mjs web/test/skin-workspace.test.ts web/test/voice-performance.test.mjs web/test/jitter-buffer.test.ts web/test/remote-playback.test.ts web/test/opus-uplink.test.ts web/test/screen-share.test.ts web/test/screen-share-ui.test.mjs web/test/android-gateway.test.ts web/src/services/skin-catalog.test.ts web/src/services/skin-content.test.ts web/src/services/skin-plugin-runtime.test.ts web/src/services/skin-plugin-authoring.test.ts web/src/services/skin-editor-mode.test.ts web/src/services/skin-plugin-approval.test.ts web/src/services/host-editor-top-layer.test.ts web/src/services/skin-extension-ui.test.ts web/src/services/member-menu-placement.test.ts web/src/services/audio-device-menu-placement.test.ts web/src/services/mobile-viewport.test.ts web/src/services/mobile-away.test.ts web/src/services/screen-wake-lock.test.ts web/src/services/microphone-start.test.ts web/src/services/skin-pack.test.ts web/src/services/skin-runtime-plugin-approval.test.ts web/src/services/skin-layout-storage.test.ts web/src/services/skin-layout-geometry.test.ts web/src/services/skin-layout-focus.test.ts web/test/skin-layout-runtime.test.mjs web/test/skin-plugin-editor.test.mjs web/src/services/identity-import.test.ts web/src/services/identity-provider.test.ts web/test/identity-dialog.test.mjs web/test/skin-lifecycle.test.mjs web/src/services/local-persistence.test.ts web/src/services/quick-servers.test.ts src/server/teamspeak-alias.test.ts src/server/teamspeak-alias-integration.test.ts web/src/services/teamspeak-target.test.ts web/src/services/skin-extension-sandbox.test.ts web/src/services/skin-extension-wasm-policy.test.ts web/src/services/skin-extension-wasm-sandbox.test.ts web/src/services/skin-runtime-plugin-wasm.test.ts web/src/services/skin-extension-wasm-ui-loop.test.ts web/src/services/skin-wasm-interpreter.test.ts src/plugins/plugins.test.ts web/test/plugins.integration.test.ts web/src/services/plugin-app-client.test.ts web/src/services/instance-authorization.test.ts web/src/services/host-chrome-visibility.test.ts web/src/services/host-control-tokens.test.ts web/src/services/host-recovery-helpers.test.ts web/src/services/host-slot-placement.test.ts web/src/services/host-floating-placement.test.ts web/test/host-chrome-recovery.test.mjs web/src/services/host-recovery-presentation.test.ts",
|
||||
"test": "node --import tsx --test src/admin/security-boundaries.test.ts src/admin/update-routes.test.ts src/updater/version.test.ts src/updater/deployment.test.ts src/updater/archive.test.ts src/updater/code-swap.test.ts src/updater/update-state.test.ts src/updater/update-service.test.ts src/updater/restart-runner.test.ts src/updater/swap-recovery.test.ts src/domain/teamspeak-target.test.ts web/src/voice/member-volume-preferences.test.ts web/src/services/voice-channel-tree.test.ts src/admin/skin-registry.test.ts web/test/skin-store.test.ts src/admin/ts-admin-service.test.ts web/test/admin-api.integration.test.ts web/test/admin-view.test.mjs web/src/services/admin-api.test.ts src/security/open-target-policy.test.ts scripts/acceleration-poc/target-guard-parity.test.mjs src/server/acceleration-relay.test.ts src/server/visitor-count.test.ts src/server/voice-gateway-auth.test.ts src/server/voice-gateway.test.ts src/server/relay-delegation.integration.test.ts src/persistence/database.test.ts src/server/voice-protocol.test.ts src/server/teamspeak-resolver.test.ts src/server/teamspeak-adapter.test.ts src/server/teamspeak-sdk.test.ts src/server/ts-client.test.ts src/server/join-ticket.test.ts src/server/identity-lease.test.ts src/server/session-manager.test.ts src/server/directory-sync.test.ts src/server/session-events.test.ts src/server/reconnect-policy.test.ts src/server/voice-commands.test.ts src/server/voice-bridge.test.ts src/server/session-audio.test.ts src/server/voice-bridge.integration.test.ts src/server/webrtc-audio.test.ts src/server/webrtc-config.test.ts src/server/audio-stats.test.ts src/server/turn-credentials.test.ts src/server/voice-ice-config.test.ts src/server/audio-pacer.test.ts src/server/channel-capacity.test.ts src/server/directory-view.test.ts src/server/member-avatars.test.ts src/server/screen-share-coordinator.test.ts src/shared/client-commands.test.ts src/shared/skin-layout.test.ts src/shared/skin-css.test.ts src/shared/skin-plugin.test.ts src/shared/skin-runtime-plugin-context.test.ts src/shared/skin-runtime-plugins.test.ts src/shared/skin-runtime-plugin-approval.test.ts src/shared/server-messages.test.ts src/shared/voice-ice.test.ts src/shared/voice-profile.test.ts src/shared/webrtc.test.ts scripts/docker-healthcheck.test.mjs web/test/voice-session.test.mjs web/test/audio-controls.test.mjs web/test/connection-dialogs.test.mjs web/test/voice-workspace.test.mjs web/test/skin-workspace.test.ts web/test/voice-performance.test.mjs web/test/jitter-buffer.test.ts web/test/remote-playback.test.ts web/test/opus-uplink.test.ts web/test/screen-share.test.ts web/test/screen-share-ui.test.mjs web/test/android-gateway.test.ts web/src/services/skin-catalog.test.ts web/src/services/skin-content.test.ts web/src/services/skin-plugin-runtime.test.ts web/src/services/skin-plugin-authoring.test.ts web/src/services/skin-editor-mode.test.ts web/src/services/skin-plugin-approval.test.ts web/src/services/host-editor-top-layer.test.ts web/src/services/skin-extension-ui.test.ts web/src/services/member-menu-placement.test.ts web/src/services/audio-device-menu-placement.test.ts web/src/services/mobile-viewport.test.ts web/src/services/mobile-away.test.ts web/src/services/screen-wake-lock.test.ts web/src/services/microphone-start.test.ts web/src/services/skin-pack.test.ts web/src/services/skin-runtime-plugin-approval.test.ts web/src/services/skin-layout-storage.test.ts web/src/services/skin-layout-geometry.test.ts web/src/services/skin-layout-focus.test.ts web/test/skin-layout-runtime.test.mjs web/test/skin-plugin-editor.test.mjs web/src/services/identity-import.test.ts web/src/services/identity-provider.test.ts web/test/identity-dialog.test.mjs web/test/skin-lifecycle.test.mjs web/src/services/local-persistence.test.ts web/src/services/quick-servers.test.ts src/server/teamspeak-alias.test.ts src/server/teamspeak-alias-integration.test.ts web/src/services/teamspeak-target.test.ts web/src/services/skin-extension-sandbox.test.ts web/src/services/skin-extension-wasm-policy.test.ts web/src/services/skin-extension-wasm-sandbox.test.ts web/src/services/skin-runtime-plugin-wasm.test.ts web/src/services/skin-extension-wasm-ui-loop.test.ts web/src/services/skin-wasm-interpreter.test.ts src/plugins/plugins.test.ts web/test/plugins.integration.test.ts web/src/services/plugin-app-client.test.ts web/src/services/instance-authorization.test.ts web/src/services/host-chrome-visibility.test.ts web/src/services/host-control-tokens.test.ts web/src/services/host-recovery-helpers.test.ts web/src/services/host-slot-placement.test.ts web/src/services/host-floating-placement.test.ts web/test/host-chrome-recovery.test.mjs web/src/services/host-recovery-presentation.test.ts web/test/opus-uplink-browser.test.mjs",
|
||||
"verify": "npm test && npm run build && npm run web:build",
|
||||
"skin:harbor:build": "node web/scripts/build-harbor-voice-skin.mjs",
|
||||
"skin:open-voice:build": "node web/scripts/build-open-voice-surface-skin.mjs",
|
||||
|
||||
@@ -7,6 +7,35 @@ import { DatabaseSync } from "node:sqlite";
|
||||
import { encryptSecret, decryptSecret } from "../security/secret-crypto.js";
|
||||
import { DATABASE_SCHEMA_VERSION, WebSpeakDatabase } from "./database.js";
|
||||
|
||||
test("voice overrides preserve schema 13 and survive an old binary updating ordinary settings", t => {
|
||||
const directory = mkdtempSync(path.join(tmpdir(), "webspeak-voice-rollback-"));
|
||||
const filename = path.join(directory, "webspeak.db");
|
||||
t.after(() => rmSync(directory, { recursive: true, force: true }));
|
||||
const database = new WebSpeakDatabase(filename);
|
||||
const encrypted = encryptSecret("turn-test-secret-value", Buffer.alloc(32, 7), "webspeak:voice-turn-rest-secret:v1");
|
||||
database.updateSettings({ ...database.getSettings(), voiceProfile: "adaptive", voiceTurnUrls: "turn:turn.example.com:3478",
|
||||
voiceTurnSecretEncrypted: encrypted, voiceTurnTtlSeconds: 3600, voiceOpusWs: true, voiceJitterMaxMs: 200 });
|
||||
database.close();
|
||||
const legacy = new DatabaseSync(filename);
|
||||
try {
|
||||
const version = legacy.prepare("PRAGMA user_version").get() as { user_version: number };
|
||||
assert.equal(version.user_version, 13, "0.3.3 rejects any schema version above 13");
|
||||
assert.equal((legacy.prepare("PRAGMA table_info(settings)").all() as { name: string }[]).some(row => row.name.startsWith("voice_")), false);
|
||||
legacy.prepare("UPDATE settings SET site_name = ? WHERE id = 1").run("Updated by old binary");
|
||||
} finally { legacy.close(); }
|
||||
const reopened = new WebSpeakDatabase(filename);
|
||||
try {
|
||||
const settings = reopened.getSettings();
|
||||
assert.equal(settings.siteName, "Updated by old binary");
|
||||
assert.equal(settings.voiceProfile, "adaptive");
|
||||
assert.equal(settings.voiceTurnSecretEncrypted, encrypted);
|
||||
assert.equal(settings.voiceOpusWs, true);
|
||||
assert.equal(settings.voiceJitterMaxMs, 200);
|
||||
reopened.setMeta("voice_settings_v1", "invalid-json");
|
||||
assert.equal(reopened.getSettings().voiceProfile, null);
|
||||
} finally { reopened.close(); }
|
||||
});
|
||||
|
||||
test("relay voice endpoint is stored by the current database migration", (context) => {
|
||||
const directory = mkdtempSync(path.join(tmpdir(), "webspeak-relay-db-"));
|
||||
const database = new WebSpeakDatabase(path.join(directory, "webspeak.sqlite"));
|
||||
@@ -15,7 +44,7 @@ test("relay voice endpoint is stored by the current database migration", (contex
|
||||
rmSync(directory, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
assert.equal(DATABASE_SCHEMA_VERSION, 14);
|
||||
assert.equal(DATABASE_SCHEMA_VERSION, 13);
|
||||
assert.equal(database.schemaVersion, DATABASE_SCHEMA_VERSION);
|
||||
assert.equal(database.getTsAdminSettings().transport, "web");
|
||||
assert.equal(database.getTsAdminSettings().enabled, false);
|
||||
@@ -38,13 +67,13 @@ test("schema 11 migration preserves encrypted SSH credentials and does not silen
|
||||
const original = new WebSpeakDatabase(filename);
|
||||
original.close();
|
||||
const old = new DatabaseSync(filename);
|
||||
old.exec("ALTER TABLE ts_admin_settings DROP COLUMN transport; ALTER TABLE ts_admin_settings DROP COLUMN query_host; ALTER TABLE ts_admin_settings DROP COLUMN web_query_url; ALTER TABLE ts_admin_settings DROP COLUMN api_key_encrypted; ALTER TABLE ts_admin_settings DROP COLUMN server_id; DROP TABLE workspace_invites; ALTER TABLE settings DROP COLUMN voice_profile; ALTER TABLE settings DROP COLUMN voice_turn_urls; ALTER TABLE settings DROP COLUMN voice_turn_secret_encrypted; ALTER TABLE settings DROP COLUMN voice_turn_ttl_seconds; ALTER TABLE settings DROP COLUMN voice_opus_ws; ALTER TABLE settings DROP COLUMN voice_jitter_max_ms; PRAGMA user_version = 11;");
|
||||
old.exec("ALTER TABLE ts_admin_settings DROP COLUMN transport; ALTER TABLE ts_admin_settings DROP COLUMN query_host; ALTER TABLE ts_admin_settings DROP COLUMN web_query_url; ALTER TABLE ts_admin_settings DROP COLUMN api_key_encrypted; ALTER TABLE ts_admin_settings DROP COLUMN server_id; DROP TABLE workspace_invites; PRAGMA user_version = 11;");
|
||||
old.prepare("UPDATE ts_admin_settings SET enabled=1, query_port=10222, username='query-owner', password_encrypted=?, host_key_fingerprint=?").run(encrypted, `SHA256:${"A".repeat(43)}`);
|
||||
old.close();
|
||||
const migrated = new WebSpeakDatabase(filename);
|
||||
t.after(() => { migrated.close(); rmSync(directory, { recursive: true, force: true }); });
|
||||
const settings = migrated.getTsAdminSettings();
|
||||
assert.equal(migrated.schemaVersion, 14);
|
||||
assert.equal(migrated.schemaVersion, 13);
|
||||
assert.equal(settings.transport, "ssh"); assert.equal(settings.enabled, true);
|
||||
assert.equal(settings.queryPort, 10222); assert.equal(settings.username, "query-owner");
|
||||
assert.equal(settings.passwordEncrypted, encrypted);
|
||||
|
||||
+31
-38
@@ -7,7 +7,8 @@ import type { TeamSpeakProtocol } from "../server/teamspeak-adapter.js";
|
||||
import { DEFAULT_WEBRTC_UDP_PORT_RANGE } from "../server/webrtc-config.js";
|
||||
import type { VoiceProfileSetting } from "../shared/voice-profile.js";
|
||||
|
||||
export const DATABASE_SCHEMA_VERSION = 14;
|
||||
export const DATABASE_SCHEMA_VERSION = 13;
|
||||
const VOICE_SETTINGS_META_KEY = "voice_settings_v1";
|
||||
export type AccessMode = "fixed" | "open";
|
||||
|
||||
export interface PersistedSettings {
|
||||
@@ -158,12 +159,6 @@ interface SettingsRow extends Record<string, unknown> {
|
||||
webrtc_stun_server: string;
|
||||
webrtc_udp_start: number;
|
||||
webrtc_udp_end: number;
|
||||
voice_profile: string | null;
|
||||
voice_turn_urls: string | null;
|
||||
voice_turn_secret_encrypted: string | null;
|
||||
voice_turn_ttl_seconds: number | null;
|
||||
voice_opus_ws: number | null;
|
||||
voice_jitter_max_ms: number | null;
|
||||
relay_configured: number;
|
||||
relay_enabled: number;
|
||||
relay_name: string;
|
||||
@@ -267,6 +262,7 @@ export class WebSpeakDatabase {
|
||||
|
||||
getSettings(): PersistedSettings {
|
||||
const row = this.database.prepare("SELECT * FROM settings WHERE id = 1").get() as SettingsRow;
|
||||
const voice = this.readVoiceSettings();
|
||||
return {
|
||||
siteName: row.site_name,
|
||||
welcomeText: row.welcome_text,
|
||||
@@ -289,12 +285,7 @@ export class WebSpeakDatabase {
|
||||
webRtcStunServer: row.webrtc_stun_server,
|
||||
webRtcUdpStart: row.webrtc_udp_start,
|
||||
webRtcUdpEnd: row.webrtc_udp_end,
|
||||
voiceProfile: row.voice_profile === "legacy" || row.voice_profile === "adaptive" || row.voice_profile === "auto" ? row.voice_profile : null,
|
||||
voiceTurnUrls: row.voice_turn_urls,
|
||||
voiceTurnSecretEncrypted: row.voice_turn_secret_encrypted,
|
||||
voiceTurnTtlSeconds: row.voice_turn_ttl_seconds,
|
||||
voiceOpusWs: row.voice_opus_ws === null ? null : row.voice_opus_ws === 1,
|
||||
voiceJitterMaxMs: row.voice_jitter_max_ms,
|
||||
...voice,
|
||||
relayConfigured: row.relay_configured === 1,
|
||||
relayEnabled: row.relay_enabled === 1,
|
||||
relayName: row.relay_name,
|
||||
@@ -780,33 +771,35 @@ export class WebSpeakDatabase {
|
||||
); CREATE INDEX workspace_invites_expiry ON workspace_invites(expires_at);
|
||||
PRAGMA user_version = 13;`);
|
||||
});
|
||||
version = 13;
|
||||
}
|
||||
if (version === 13) {
|
||||
this.transaction(() => {
|
||||
this.database.exec(`
|
||||
-- Console-managed voice deployment overrides. NULL keeps the
|
||||
-- environment baseline; an empty TURN URL or secret explicitly
|
||||
-- disables the corresponding environment value.
|
||||
ALTER TABLE settings ADD COLUMN voice_profile TEXT CHECK (voice_profile IS NULL OR voice_profile IN ('auto', 'legacy', 'adaptive'));
|
||||
ALTER TABLE settings ADD COLUMN voice_turn_urls TEXT;
|
||||
ALTER TABLE settings ADD COLUMN voice_turn_secret_encrypted TEXT;
|
||||
ALTER TABLE settings ADD COLUMN voice_turn_ttl_seconds INTEGER CHECK (voice_turn_ttl_seconds IS NULL OR voice_turn_ttl_seconds BETWEEN 300 AND 86400);
|
||||
ALTER TABLE settings ADD COLUMN voice_opus_ws INTEGER CHECK (voice_opus_ws IS NULL OR voice_opus_ws IN (0, 1));
|
||||
ALTER TABLE settings ADD COLUMN voice_jitter_max_ms INTEGER CHECK (voice_jitter_max_ms IS NULL OR voice_jitter_max_ms BETWEEN 80 AND 500);
|
||||
PRAGMA user_version = 14;
|
||||
`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** Optional settings must survive a code-only rollback to the 0.3.3 schema. */
|
||||
private readVoiceSettings(): Pick<PersistedSettings, "voiceProfile" | "voiceTurnUrls" | "voiceTurnSecretEncrypted" | "voiceTurnTtlSeconds" | "voiceOpusWs" | "voiceJitterMaxMs"> {
|
||||
let value: Record<string, unknown> = {};
|
||||
try {
|
||||
const parsed: unknown = JSON.parse(this.getMeta(VOICE_SETTINGS_META_KEY) ?? "{}");
|
||||
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) value = parsed as Record<string, unknown>;
|
||||
} catch { /* A malformed optional value inherits the deployment defaults. */ }
|
||||
return {
|
||||
voiceProfile: value.voiceProfile === "legacy" || value.voiceProfile === "adaptive" || value.voiceProfile === "auto"
|
||||
? value.voiceProfile : null,
|
||||
voiceTurnUrls: typeof value.voiceTurnUrls === "string" ? value.voiceTurnUrls : null,
|
||||
voiceTurnSecretEncrypted: typeof value.voiceTurnSecretEncrypted === "string" ? value.voiceTurnSecretEncrypted : null,
|
||||
voiceTurnTtlSeconds: Number.isInteger(value.voiceTurnTtlSeconds) && Number(value.voiceTurnTtlSeconds) >= 300 && Number(value.voiceTurnTtlSeconds) <= 86400
|
||||
? Number(value.voiceTurnTtlSeconds) : null,
|
||||
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,
|
||||
};
|
||||
}
|
||||
|
||||
private writeSettings(settings: SettingsUpdate, now: string): void {
|
||||
this.database.prepare(
|
||||
`UPDATE settings SET
|
||||
site_name = ?, welcome_text = ?, welcome_text_en = ?, welcome_text_de = ?, welcome_text_ru = ?, welcome_text_ja = ?, access_mode = ?, ts_host = ?, ts_port = ?, ts_target = ?,
|
||||
ts_password_encrypted = ?, webrtc_enabled = ?, webrtc_public_host = ?, webrtc_ipv6_enabled = ?, webrtc_stun_server = ?, webrtc_udp_start = ?,
|
||||
webrtc_udp_end = ?, voice_profile = ?, voice_turn_urls = ?, voice_turn_secret_encrypted = ?, voice_turn_ttl_seconds = ?, voice_opus_ws = ?, voice_jitter_max_ms = ?,
|
||||
relay_configured = ?, relay_enabled = ?, relay_name = ?,
|
||||
webrtc_udp_end = ?, relay_configured = ?, relay_enabled = ?, relay_name = ?,
|
||||
relay_host = ?, relay_port = ?, relay_token_encrypted = ?, updated_at = ?
|
||||
WHERE id = 1`,
|
||||
).run(
|
||||
@@ -827,12 +820,6 @@ export class WebSpeakDatabase {
|
||||
settings.webRtcStunServer ?? "",
|
||||
settings.webRtcUdpStart ?? DEFAULT_WEBRTC_UDP_PORT_RANGE[0],
|
||||
settings.webRtcUdpEnd ?? DEFAULT_WEBRTC_UDP_PORT_RANGE[1],
|
||||
settings.voiceProfile ?? null,
|
||||
settings.voiceTurnUrls ?? null,
|
||||
settings.voiceTurnSecretEncrypted ?? null,
|
||||
settings.voiceTurnTtlSeconds ?? null,
|
||||
settings.voiceOpusWs == null ? null : settings.voiceOpusWs ? 1 : 0,
|
||||
settings.voiceJitterMaxMs ?? null,
|
||||
settings.relayConfigured ? 1 : 0,
|
||||
settings.relayEnabled ? 1 : 0,
|
||||
settings.relayName,
|
||||
@@ -841,6 +828,12 @@ export class WebSpeakDatabase {
|
||||
settings.relayTokenEncrypted,
|
||||
now,
|
||||
);
|
||||
// writeSettings is called within the caller's settings transaction. Older
|
||||
// binaries ignore this key and keep it intact when updating other fields.
|
||||
this.setMeta(VOICE_SETTINGS_META_KEY, JSON.stringify({
|
||||
...this.readVoiceSettings(),
|
||||
...Object.fromEntries(Object.entries(settings).filter(([key, value]) => key.startsWith("voice") && value !== undefined)),
|
||||
}));
|
||||
}
|
||||
|
||||
private insertAudit(event: string, details: Record<string, unknown>, now: string): void {
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { TSVoiceData } from "./ts-client.js";
|
||||
|
||||
function fixture() {
|
||||
const state = { current: true, ready: true, now: 0, targets: null as number[] | null, disposed: 0,
|
||||
peer: null as { pushTeamSpeakVoice(data: TSVoiceData): void } | null };
|
||||
peer: null as { isConnected: boolean; pushTeamSpeakVoice(data: TSVoiceData): void } | null };
|
||||
const audio = createAudioFlowStats();
|
||||
const packets: Buffer[] = [];
|
||||
const encoded: Buffer[] = [];
|
||||
@@ -146,7 +146,7 @@ test("tagged PCM and pre-encoded Opus frames share the uplink without double enc
|
||||
|
||||
test("WebRTC ingress excludes queued PCM and fallback re-enables PCM", () => {
|
||||
const f = fixture();
|
||||
f.state.peer = { pushTeamSpeakVoice() {} };
|
||||
f.state.peer = { isConnected: true, pushTeamSpeakVoice() {} };
|
||||
f.transport.receivePcm(Buffer.alloc(1_920));
|
||||
const opus = Buffer.from([3, 2, 1]);
|
||||
f.transport.receiveWebRtc(opus, 5);
|
||||
@@ -188,7 +188,7 @@ test("backpressure drops bursts above 4096 bytes and resumes without a retained
|
||||
test("WebRTC downlink owns egress without a duplicate WebSocket packet", () => {
|
||||
const f = fixture();
|
||||
const received: TSVoiceData[] = [];
|
||||
f.state.peer = { pushTeamSpeakVoice: data => { received.push(data); } };
|
||||
f.state.peer = { isConnected: true, pushTeamSpeakVoice: data => { received.push(data); } };
|
||||
f.transport.receiveTeamSpeak(f.remote());
|
||||
assert.equal(received.length, 1);
|
||||
assert.equal(f.packets.length, 0);
|
||||
@@ -198,6 +198,28 @@ test("WebRTC downlink owns egress without a duplicate WebSocket packet", () => {
|
||||
assert.equal(f.packets.length, 1);
|
||||
});
|
||||
|
||||
test("negotiating WebRTC keeps both compatibility directions until the media path connects", () => {
|
||||
const f = fixture();
|
||||
const received: TSVoiceData[] = [];
|
||||
f.state.peer = { isConnected: false, pushTeamSpeakVoice: data => received.push(data) };
|
||||
f.transport.receivePcm(Buffer.alloc(1920));
|
||||
f.transport.receiveTeamSpeak(f.remote());
|
||||
assert.equal(f.forwarded.length, 1);
|
||||
assert.equal(f.packets.length, 1);
|
||||
assert.equal(received.length, 0);
|
||||
f.state.peer.isConnected = true;
|
||||
f.transport.receivePcm(Buffer.alloc(1920));
|
||||
f.transport.receiveTeamSpeak(f.remote());
|
||||
assert.equal(f.forwarded.length, 1);
|
||||
assert.equal(f.packets.length, 1);
|
||||
assert.equal(received.length, 1);
|
||||
f.state.peer.isConnected = false;
|
||||
f.transport.receivePcm(Buffer.alloc(1920));
|
||||
f.transport.receiveTeamSpeak(f.remote());
|
||||
assert.equal(f.forwarded.length, 2);
|
||||
assert.equal(f.packets.length, 2);
|
||||
});
|
||||
|
||||
test("encoding failures are counted and reported at most once per five seconds", t => {
|
||||
const f = fixture();
|
||||
t.mock.method(f.encoder, "encode", () => { throw new Error("Codec failed"); });
|
||||
@@ -220,7 +242,7 @@ test("SDK and downlink failures cannot escape the audio callbacks", t => {
|
||||
assert.equal(f.notices.length, 0, "SDK failure must not be reported as an encoder failure");
|
||||
t.mock.method(f.socket, "send", () => { throw new Error("Socket closed"); });
|
||||
f.transport.receiveTeamSpeak(f.remote());
|
||||
f.state.peer = { pushTeamSpeakVoice() { throw new Error("Peer closed"); } };
|
||||
f.state.peer = { isConnected: true, pushTeamSpeakVoice() { throw new Error("Peer closed"); } };
|
||||
f.transport.receiveTeamSpeak(f.remote());
|
||||
assert.equal(f.audio.egressDroppedFrames, 2);
|
||||
});
|
||||
|
||||
@@ -41,7 +41,7 @@ export interface SessionAudioOptions {
|
||||
isCurrent(): boolean;
|
||||
isReady(): boolean;
|
||||
selfId(): number;
|
||||
peer(): Pick<WebRtcAudioSession, "pushTeamSpeakVoice"> | null;
|
||||
peer(): Pick<WebRtcAudioSession, "pushTeamSpeakVoice" | "isConnected"> | null;
|
||||
whisperTargets(): readonly number[] | null;
|
||||
sendJson(message: ServerMessage): void;
|
||||
/** Tests that assert synchronous SDK calls can opt out; production keeps pacing. */
|
||||
@@ -64,7 +64,9 @@ export class SessionAudioTransport {
|
||||
this.encoder = encoder;
|
||||
this.logger = options.logger ?? null;
|
||||
this.pacer = options.pacing === false ? null : new AudioPacer(
|
||||
(data, codec) => this.sendVoice(data, codec),
|
||||
(data, codec) => {
|
||||
if (!this.mediaPeer()) this.sendVoice(data, codec);
|
||||
},
|
||||
{
|
||||
now: this.rateClock,
|
||||
onStats: stats => {
|
||||
@@ -81,6 +83,11 @@ export class SessionAudioTransport {
|
||||
return !this.closed && this.options.isCurrent() && this.options.socket.readyState === WebSocket.OPEN;
|
||||
}
|
||||
|
||||
private mediaPeer() {
|
||||
const peer = this.options.peer();
|
||||
return peer?.isConnected ? peer : null;
|
||||
}
|
||||
|
||||
private recordIngress(): void {
|
||||
const stats = this.options.audio;
|
||||
const now = this.clock();
|
||||
@@ -153,7 +160,7 @@ export class SessionAudioTransport {
|
||||
// route is down is discarded whatever its size, so calling it malformed would
|
||||
// misattribute the drop and raise a spurious client error in the browser.
|
||||
// Late TCP frames from before a WebRTC switch must not duplicate RTP audio.
|
||||
if (!this.options.isReady() || this.options.peer()) { stats.ingressDroppedFrames++; return; }
|
||||
if (!this.options.isReady() || this.mediaPeer()) { stats.ingressDroppedFrames++; return; }
|
||||
const legacyPcm = frame.length === AUDIO_FRAME_BYTES ? frame : null;
|
||||
const taggedPcm = frame.length === TAGGED_PCM_FRAME_BYTES && frame[0] === PCM_FRAME_TAG ? frame.subarray(1) : null;
|
||||
const opus = frame.length > 1 && frame.length <= MAX_OPUS_FRAME_BYTES + 1 && frame[0] === OPUS_FRAME_TAG
|
||||
@@ -227,7 +234,7 @@ export class SessionAudioTransport {
|
||||
stats.egressLastAt = now;
|
||||
const key = String(data.clientId);
|
||||
stats.egressFramesByClient[key] = (stats.egressFramesByClient[key] ?? 0) + 1;
|
||||
const peer = this.options.peer();
|
||||
const peer = this.mediaPeer();
|
||||
if (peer) {
|
||||
try { peer.pushTeamSpeakVoice(data); stats.egressFrames++; }
|
||||
catch { stats.egressDroppedFrames++; }
|
||||
|
||||
@@ -131,11 +131,11 @@ test("schema 8 settings and invites survive the nickname migration", async (cont
|
||||
});
|
||||
database.close();
|
||||
const legacy = new DatabaseSync(file);
|
||||
legacy.exec("DROP TABLE ts_admin_settings; ALTER TABLE relay_nodes DROP COLUMN voice_endpoint; ALTER TABLE settings DROP COLUMN ts_target; ALTER TABLE managed_invites DROP COLUMN target_text; DROP TABLE workspace_invites; ALTER TABLE settings DROP COLUMN voice_profile; ALTER TABLE settings DROP COLUMN voice_turn_urls; ALTER TABLE settings DROP COLUMN voice_turn_secret_encrypted; ALTER TABLE settings DROP COLUMN voice_turn_ttl_seconds; ALTER TABLE settings DROP COLUMN voice_opus_ws; ALTER TABLE settings DROP COLUMN voice_jitter_max_ms; PRAGMA user_version = 8;");
|
||||
legacy.exec("DROP TABLE ts_admin_settings; ALTER TABLE relay_nodes DROP COLUMN voice_endpoint; ALTER TABLE settings DROP COLUMN ts_target; ALTER TABLE managed_invites DROP COLUMN target_text; DROP TABLE workspace_invites; PRAGMA user_version = 8;");
|
||||
legacy.close();
|
||||
const migrated = new WebSpeakDatabase(file);
|
||||
try {
|
||||
assert.equal(migrated.schemaVersion, 14);
|
||||
assert.equal(migrated.schemaVersion, 13);
|
||||
assert.equal(migrated.getSettings().tsHost, "127.0.0.1");
|
||||
assert.equal(migrated.getSettings().tsTarget, null);
|
||||
const invite = migrated.consumeManagedInvite("legacy-token");
|
||||
|
||||
@@ -18,6 +18,7 @@ function deferred() {
|
||||
}
|
||||
|
||||
class PeerStub {
|
||||
isConnected = true;
|
||||
closed = false;
|
||||
closeResult = Promise.resolve();
|
||||
answerResult = Promise.resolve();
|
||||
|
||||
@@ -258,6 +258,10 @@ export class WebRtcAudioSession {
|
||||
};
|
||||
}
|
||||
|
||||
get isConnected(): boolean {
|
||||
return !this.closed && this.peer.connectionState === "connected";
|
||||
}
|
||||
|
||||
getStats(): WebRtcAudioStats {
|
||||
return { ...this.stats, webrtcQueueCurrentFrames: this.getQueueFrameCount() };
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
def appVersion = project.hasProperty('appVersion') ? project.property('appVersion').toString() : '0.3.3'
|
||||
def appVersionCode = project.hasProperty('appVersionCode') ? project.property('appVersionCode').toString().toInteger() : 303
|
||||
def appVersion = project.hasProperty('appVersion') ? project.property('appVersion').toString() : '0.3.4-dev.0'
|
||||
def appVersionCode = project.hasProperty('appVersionCode') ? project.property('appVersionCode').toString().toInteger() : 304
|
||||
|
||||
android {
|
||||
namespace = "io.webspeak.client"
|
||||
|
||||
Generated
+2
-2
@@ -25,7 +25,7 @@
|
||||
"vite": "^6.4.3",
|
||||
"vue-tsc": "^2.2.8"
|
||||
},
|
||||
"version": "0.3.3"
|
||||
"version": "0.3.4-dev.0"
|
||||
},
|
||||
"node_modules/@babel/helper-string-parser": {
|
||||
"version": "7.27.1",
|
||||
@@ -2952,5 +2952,5 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"version": "0.3.3"
|
||||
"version": "0.3.4-dev.0"
|
||||
}
|
||||
+1
-1
@@ -27,5 +27,5 @@
|
||||
"vite": "^6.4.3",
|
||||
"vue-tsc": "^2.2.8"
|
||||
},
|
||||
"version": "0.3.3"
|
||||
"version": "0.3.4-dev.0"
|
||||
}
|
||||
Binary file not shown.
@@ -925,7 +925,7 @@ export function useVoiceWebSocket() {
|
||||
const sequence = voiceConnection.generation;
|
||||
const socket = ws.value;
|
||||
const isCurrent = () => generation === inputDeviceGeneration && sequence === voiceConnection.generation;
|
||||
const shouldRestartWebRtc = webrtc.active && Boolean(ws.value);
|
||||
const shouldRestartWebRtc = Boolean(webrtc.peer) && Boolean(ws.value);
|
||||
try {
|
||||
// Keep the current peer alive until the replacement microphone is ready.
|
||||
if (micStream) await startMicrophone();
|
||||
@@ -1485,7 +1485,7 @@ export function useVoiceWebSocket() {
|
||||
voxAttack = 0;
|
||||
voxRelease = 0;
|
||||
accumLen = 0;
|
||||
if (webrtc.active) micStream?.getAudioTracks().forEach((track) => { track.enabled = !muted; });
|
||||
if (webrtc.peer) micStream?.getAudioTracks().forEach((track) => { track.enabled = !muted; });
|
||||
webrtc.input?.setVolume(muted ? 0 : inputVolume.value);
|
||||
sendCmd("setMicrophoneMuted", { muted });
|
||||
if (muted && state.tsClientId) clearSpeaking(state.tsClientId);
|
||||
|
||||
@@ -490,8 +490,8 @@ test("the distributable host chrome toolbar declares its first compatible runtim
|
||||
assert.deepEqual(bundledArchive, archive, "the downloadable example and bundled skin stay in sync");
|
||||
const skin = await importSkinPack(new File([archive], "host-chrome-toolbar.wskin", { type: "application/octet-stream" }));
|
||||
assert.equal(skin.id, "community.host-chrome-toolbar");
|
||||
assert.equal(skin.minAppVersion, "0.3.3", "mode, appearance and anchor arrays are unavailable in WebSpeak 0.3.2");
|
||||
assert.equal(skin.version, "1.1.1");
|
||||
assert.equal(skin.minAppVersion, "0.3.4-dev.0", "released WebSpeak 0.3.3 rejects the new toolbar slot fields");
|
||||
assert.equal(skin.version, "1.1.2");
|
||||
assert.equal(APP_VERSION, skin.minAppVersion, "the running build must satisfy the example's declared minimum");
|
||||
assert.equal(skin.schemaVersion, 3);
|
||||
assert.equal(skin.packageType, "open-skin");
|
||||
|
||||
@@ -158,6 +158,8 @@ export function createOpusUplink(options: OpusUplinkOptions) {
|
||||
if (!active || closed || !samples.length) return active;
|
||||
let offset = 0;
|
||||
while (offset < samples.length) {
|
||||
// An encode error can deactivate the encoder inside this loop.
|
||||
if (!active) return false;
|
||||
const copy = Math.min(VOICE_FRAME_SAMPLES - pendingLength, samples.length - offset);
|
||||
pending.set(samples.subarray(offset, offset + copy), pendingLength);
|
||||
pendingLength += copy;
|
||||
@@ -171,7 +173,14 @@ export function createOpusUplink(options: OpusUplinkOptions) {
|
||||
function resetStream(): void {
|
||||
pendingLength = 0;
|
||||
timestampUs = 0;
|
||||
try { encoder?.reset(); } catch { /* reset is best effort */ }
|
||||
try {
|
||||
// WebCodecs reset clears configuration as well as pending output.
|
||||
encoder?.reset();
|
||||
encoder?.configure(OPUS_CONFIG);
|
||||
} catch (error) {
|
||||
options.onFallback(error instanceof Error ? error.message : "OPUS_RESET_FAILED");
|
||||
deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
function close(): void {
|
||||
|
||||
@@ -41,6 +41,7 @@ interface Attempt {
|
||||
active: boolean;
|
||||
closed: boolean;
|
||||
answerTimer: number | null;
|
||||
connectionTimer: number | null;
|
||||
cancelIce: (() => void) | null;
|
||||
}
|
||||
|
||||
@@ -73,6 +74,8 @@ export function createWebRtcTransport(options: TransportOptions) {
|
||||
previous.active = false;
|
||||
if (previous.answerTimer !== null) window.clearTimeout(previous.answerTimer);
|
||||
previous.answerTimer = null;
|
||||
if (previous.connectionTimer !== null) window.clearTimeout(previous.connectionTimer);
|
||||
previous.connectionTimer = null;
|
||||
const cancelIce = previous.cancelIce;
|
||||
previous.cancelIce = null;
|
||||
if (cancelIce) clean(cancelIce);
|
||||
@@ -84,6 +87,7 @@ export function createWebRtcTransport(options: TransportOptions) {
|
||||
if (peer) {
|
||||
clean(() => { peer.ontrack = null; });
|
||||
clean(() => { peer.onconnectionstatechange = null; });
|
||||
clean(() => { peer.onicecandidateerror = null; });
|
||||
clean(() => peer.close());
|
||||
}
|
||||
}
|
||||
@@ -98,6 +102,15 @@ export function createWebRtcTransport(options: TransportOptions) {
|
||||
if (isFailureCurrent()) await options.onFailure(reason, isFailureCurrent);
|
||||
}
|
||||
|
||||
function ready(record: Attempt): void {
|
||||
if (!isCurrent(record) || record.active || record.peer?.connectionState !== "connected"
|
||||
|| record.peer.remoteDescription?.type !== "answer") return;
|
||||
if (record.connectionTimer !== null) window.clearTimeout(record.connectionTimer);
|
||||
record.connectionTimer = null;
|
||||
record.active = true;
|
||||
options.onReady();
|
||||
}
|
||||
|
||||
async function waitForIce(record: Attempt, peer: RTCPeerConnection): Promise<void> {
|
||||
if (peer.iceGatheringState === "complete") return;
|
||||
await new Promise<void>(resolve => {
|
||||
@@ -120,7 +133,7 @@ export function createWebRtcTransport(options: TransportOptions) {
|
||||
async function start(connection: Connection): Promise<void> {
|
||||
stop();
|
||||
const record: Attempt = { connection, peer: null, input: null, meter: null,
|
||||
active: false, closed: false, answerTimer: null, cancelIce: null };
|
||||
active: false, closed: false, answerTimer: null, connectionTimer: null, cancelIce: null };
|
||||
current = record;
|
||||
let microphone: Microphone | null;
|
||||
try { microphone = await options.prepareMicrophone(); }
|
||||
@@ -161,10 +174,10 @@ export function createWebRtcTransport(options: TransportOptions) {
|
||||
peer.onconnectionstatechange = () => {
|
||||
options.onConnectionState?.(peer.connectionState);
|
||||
if (isCurrent(record) && peer.connectionState === "failed") void failAttempt(record, "WEBRTC_CONNECTION_FAILED");
|
||||
else ready(record);
|
||||
};
|
||||
options.onConnectionState?.(peer.connectionState);
|
||||
|
||||
record.active = true;
|
||||
const offer = await peer.createOffer();
|
||||
if (!isCurrent(record)) return;
|
||||
await peer.setLocalDescription({ ...offer, sdp: addOpusFmtpParameters(offer.sdp ?? "", ["stereo=1"]) });
|
||||
@@ -196,8 +209,16 @@ export function createWebRtcTransport(options: TransportOptions) {
|
||||
if (!isCurrent(record)) return;
|
||||
if (record.answerTimer !== null) window.clearTimeout(record.answerTimer);
|
||||
record.answerTimer = null;
|
||||
record.active = true;
|
||||
options.onReady();
|
||||
// An SDP answer acknowledges signaling, not a working ICE/DTLS path.
|
||||
// Keep compatibility audio until the peer really connects, and bound
|
||||
// attempts that remain stuck in "connecting" without a failed event.
|
||||
ready(record);
|
||||
if (!record.active && record.connectionTimer === null) {
|
||||
record.connectionTimer = window.setTimeout(() => {
|
||||
record.connectionTimer = null;
|
||||
if (isCurrent(record) && !record.active) void failAttempt(record, "WEBRTC_CONNECTION_TIMEOUT");
|
||||
}, 15_000);
|
||||
}
|
||||
} catch { await failAttempt(record, "WEBRTC_ANSWER_REJECTED"); }
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ test("schema 7 upgrades preserve the previously unused public host and initializ
|
||||
const original = new WebSpeakDatabase(filename);
|
||||
original.close();
|
||||
const legacy = new DatabaseSync(filename);
|
||||
legacy.exec("DROP TABLE ts_admin_settings; ALTER TABLE relay_nodes DROP COLUMN voice_endpoint; ALTER TABLE settings DROP COLUMN ts_target; ALTER TABLE managed_invites DROP COLUMN target_text; ALTER TABLE settings DROP COLUMN webrtc_ipv6_enabled; ALTER TABLE settings DROP COLUMN webrtc_stun_server; DROP TABLE workspace_invites; ALTER TABLE settings DROP COLUMN voice_profile; ALTER TABLE settings DROP COLUMN voice_turn_urls; ALTER TABLE settings DROP COLUMN voice_turn_secret_encrypted; ALTER TABLE settings DROP COLUMN voice_turn_ttl_seconds; ALTER TABLE settings DROP COLUMN voice_opus_ws; ALTER TABLE settings DROP COLUMN voice_jitter_max_ms; PRAGMA user_version = 7;");
|
||||
legacy.exec("DROP TABLE ts_admin_settings; ALTER TABLE relay_nodes DROP COLUMN voice_endpoint; ALTER TABLE settings DROP COLUMN ts_target; ALTER TABLE managed_invites DROP COLUMN target_text; ALTER TABLE settings DROP COLUMN webrtc_ipv6_enabled; ALTER TABLE settings DROP COLUMN webrtc_stun_server; DROP TABLE workspace_invites; PRAGMA user_version = 7;");
|
||||
legacy.prepare("UPDATE settings SET webrtc_public_host = ?").run("media.example.com");
|
||||
legacy.close();
|
||||
const migrated = new WebSpeakDatabase(filename);
|
||||
|
||||
+10
-1
@@ -69,6 +69,13 @@ const rectOf = (element) => {
|
||||
};
|
||||
const withinViewport = (rect) => rect.left >= -0.5 && rect.top >= -0.5
|
||||
&& rect.right <= innerWidth + 0.5 && rect.bottom <= innerHeight + 0.5;
|
||||
// Controls may overflow a narrow anchor; they must remain clamped on screen.
|
||||
const alignedWithAnchor = (inner, outer, align = "end") => {
|
||||
const desiredLeft = align === "start" ? outer.left : outer.right - inner.width;
|
||||
const left = Math.min(Math.max(4, desiredLeft), Math.max(4, innerWidth - 4 - inner.width));
|
||||
const top = Math.min(Math.max(4, outer.top + (outer.height - inner.height) / 2), Math.max(4, innerHeight - 4 - inner.height));
|
||||
return Math.abs(inner.left - left) <= 0.5 && Math.abs(inner.top - top) <= 0.5;
|
||||
};
|
||||
const withinRect = (inner, outer) => inner.left >= outer.left - 0.5 && inner.right <= outer.right + 0.5
|
||||
&& inner.top >= outer.top - 0.5 && inner.bottom <= outer.bottom + 0.5;
|
||||
const rectsOverlap = (a, b) => Math.min(a.right, b.right) - Math.max(a.left, b.left) > 1
|
||||
@@ -257,7 +264,9 @@ try {
|
||||
const voiceAnchorRect = rectOf(document.getElementById("voice-anchor"));
|
||||
const afterSwitch = {
|
||||
...snapshot(),
|
||||
insideVoiceAnchor: openToolbars().every((bar) => withinRect(rectOf(bar), voiceAnchorRect)),
|
||||
alignedWithVoiceAnchor: openToolbars().every((bar) => alignedWithAnchor(rectOf(bar), voiceAnchorRect,
|
||||
mode === "split" && actions(bar).includes("built-in") ? "start" : "end")),
|
||||
anchorRect: voiceAnchorRect,
|
||||
resolvedVoice: resolveSkinAnchor(anchorList, document, "community.plugin-panel-fixture")?.id,
|
||||
};
|
||||
|
||||
|
||||
+12
-3
@@ -62,6 +62,13 @@ const rectOf = (element) => {
|
||||
};
|
||||
const withinViewport = (rect) => rect.left >= -0.5 && rect.top >= -0.5
|
||||
&& rect.right <= innerWidth + 0.5 && rect.bottom <= innerHeight + 0.5;
|
||||
// Controls may overflow a narrow anchor; they must remain clamped on screen.
|
||||
const alignedWithAnchor = (inner, outer, align = "end") => {
|
||||
const desiredLeft = align === "start" ? outer.left : outer.right - inner.width;
|
||||
const left = Math.min(Math.max(4, desiredLeft), Math.max(4, innerWidth - 4 - inner.width));
|
||||
const top = Math.min(Math.max(4, outer.top + (outer.height - inner.height) / 2), Math.max(4, innerHeight - 4 - inner.height));
|
||||
return Math.abs(inner.left - left) <= 0.5 && Math.abs(inner.top - top) <= 0.5;
|
||||
};
|
||||
const withinRect = (inner, outer) => inner.left >= outer.left - 0.5 && inner.right <= outer.right + 0.5
|
||||
&& inner.top >= outer.top - 0.5 && inner.bottom <= outer.bottom + 0.5;
|
||||
|
||||
@@ -109,7 +116,8 @@ try {
|
||||
const firstStyle = getComputedStyle(first);
|
||||
const initialSnapshot = {
|
||||
toolbarOpen: isOpen(initial),
|
||||
insideAnchor: withinRect(initialRect, homeRect),
|
||||
alignedWithAnchor: alignedWithAnchor(initialRect, homeRect),
|
||||
anchorRect: homeRect,
|
||||
insideViewport: withinViewport(initialRect),
|
||||
labels: buttons().map((button) => button.textContent?.trim()),
|
||||
actionCount: buttons().length,
|
||||
@@ -163,7 +171,8 @@ try {
|
||||
const voiceRect = rectOf(document.getElementById("voice-anchor"));
|
||||
const afterSwitch = {
|
||||
toolbarOpen: isOpen(toolbar()),
|
||||
insideVoiceAnchor: withinRect(rectOf(toolbar()), voiceRect),
|
||||
alignedWithVoiceAnchor: alignedWithAnchor(rectOf(toolbar()), voiceRect),
|
||||
rect: rectOf(toolbar()), anchorRect: voiceRect,
|
||||
insideViewport: withinViewport(rectOf(toolbar())),
|
||||
resolvedVoice: resolveSkinAnchor(
|
||||
["skin.home.topbar.part-host-actions", "skin.voice.topbar.part-host-actions"],
|
||||
@@ -193,7 +202,7 @@ try {
|
||||
await sleep(2200);
|
||||
const redocked = {
|
||||
toolbarOpen: isOpen(toolbar()),
|
||||
insideVoiceAnchor: withinRect(rectOf(toolbar()), rectOf(document.getElementById("voice-anchor"))),
|
||||
alignedWithVoiceAnchor: alignedWithAnchor(rectOf(toolbar()), rectOf(document.getElementById("voice-anchor"))),
|
||||
capsuleOpen: isOpen(capsule()),
|
||||
};
|
||||
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<!doctype html><meta charset="utf-8"><pre id="result">pending</pre>
|
||||
<script type="module">
|
||||
import { createOpusUplink } from "/src/voice/opus-uplink.ts";
|
||||
const fallback = [];
|
||||
const sent = [];
|
||||
let encoder;
|
||||
const uplink = createOpusUplink({
|
||||
createEncoder(output, error) { encoder = new AudioEncoder({ output, error }); return encoder; },
|
||||
send(frame) { sent.push(frame.length); return true; },
|
||||
onDrop() {},
|
||||
onFallback(reason) { fallback.push(reason); },
|
||||
});
|
||||
try {
|
||||
const initialized = await uplink.init();
|
||||
uplink.push(new Float32Array(960));
|
||||
await encoder.flush();
|
||||
const before = { active: uplink.active, frames: sent.length };
|
||||
uplink.resetStream();
|
||||
uplink.push(new Float32Array(960));
|
||||
await encoder.flush();
|
||||
document.querySelector("#result").textContent = JSON.stringify({
|
||||
initialized, before, after: { active: uplink.active, frames: sent.length }, fallback,
|
||||
});
|
||||
} catch (error) {
|
||||
document.querySelector("#result").textContent = JSON.stringify({ error: String(error) });
|
||||
} finally { uplink.close(); }
|
||||
</script>
|
||||
@@ -700,7 +700,7 @@ test("toolbar-mode recovery docks plain host buttons, de-duplicates the library
|
||||
|
||||
const initial = payload.initial;
|
||||
assert.equal(initial.toolbarOpen, true, "the toolbar did not dock into the declared anchor");
|
||||
assert.equal(initial.insideAnchor, true, "the toolbar is not placed inside the page anchor");
|
||||
assert.equal(initial.alignedWithAnchor, true, JSON.stringify(initial));
|
||||
assert.equal(initial.insideViewport, true);
|
||||
assert.equal(initial.actionCount, 2, "the group slot must render both independent host buttons");
|
||||
assert.deepEqual(initial.labels, ["Integrierten Skin verwenden", "Anwendungsbibliothek"]);
|
||||
@@ -729,7 +729,7 @@ test("toolbar-mode recovery docks plain host buttons, de-duplicates the library
|
||||
}
|
||||
|
||||
assert.equal(payload.afterSwitch.toolbarOpen, true, "the toolbar did not survive the home -> voice page switch");
|
||||
assert.equal(payload.afterSwitch.insideVoiceAnchor, true, "the toolbar stayed on the previous page anchor");
|
||||
assert.equal(payload.afterSwitch.alignedWithVoiceAnchor, true, "the toolbar stayed on the previous page anchor");
|
||||
assert.equal(payload.afterSwitch.resolvedVoice, "voice-anchor", "the candidate list did not resolve the voice anchor");
|
||||
|
||||
assert.equal(payload.fallback.toolbarOpen, false, "the toolbar stayed visible with a broken anchor");
|
||||
@@ -738,7 +738,7 @@ test("toolbar-mode recovery docks plain host buttons, de-duplicates the library
|
||||
assert.equal(payload.fallback.launcherSuppressed, true, "the fallback capsule must keep exactly one library entry");
|
||||
|
||||
assert.equal(payload.redocked.toolbarOpen, true, "the toolbar did not re-dock after the anchor returned");
|
||||
assert.equal(payload.redocked.insideVoiceAnchor, true);
|
||||
assert.equal(payload.redocked.alignedWithVoiceAnchor, true);
|
||||
assert.equal(payload.redocked.capsuleOpen, false);
|
||||
|
||||
assert.equal(payload.shortcut.capsuleOpen, true, "the shortcut did not summon the recovery capsule");
|
||||
@@ -844,7 +844,7 @@ test("real PluginPanel launcher is de-duplicated by group and split toolbars on
|
||||
assert.equal(group.clicks.builtIn, true);
|
||||
assert.equal(group.clicks.library, true);
|
||||
assert.equal(group.afterSwitch.toolbars[0].open, true, "the toolbar did not survive the page switch");
|
||||
assert.equal(group.afterSwitch.insideVoiceAnchor, true);
|
||||
assert.equal(group.afterSwitch.alignedWithVoiceAnchor, true);
|
||||
assert.equal(group.afterSwitch.resolvedVoice, "voice-anchor");
|
||||
assert.equal(group.fallback.toolbars[0].open, false, "the toolbar stayed docked with a broken anchor");
|
||||
assert.equal(group.fallback.capsuleVisible, true);
|
||||
@@ -873,7 +873,7 @@ test("real PluginPanel launcher is de-duplicated by group and split toolbars on
|
||||
assert.equal(split.clicks.library, true, "the library split toolbar button was not clickable");
|
||||
assert.equal(split.afterSwitch.toolbars[0].open, true);
|
||||
assert.equal(split.afterSwitch.toolbars[1].open, true);
|
||||
assert.equal(split.afterSwitch.insideVoiceAnchor, true);
|
||||
assert.equal(split.afterSwitch.alignedWithVoiceAnchor, true);
|
||||
for (const lang of ["de", "ru", "ja"]) {
|
||||
observableButtons({ visibleActions: split.languages[lang] }, `${lang} split desktop`);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { spawn } from "node:child_process";
|
||||
import { existsSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import test from "node:test";
|
||||
import { createServer } from "vite";
|
||||
|
||||
const chrome = [process.env.WEBSPEAK_TEST_CHROME, "/usr/bin/google-chrome", "/usr/bin/google-chrome-stable"]
|
||||
.find(candidate => candidate && existsSync(candidate));
|
||||
|
||||
test("real WebCodecs Opus encoding survives a VOX pause and reset", { skip: !chrome && "Chrome is not installed" }, async t => {
|
||||
const server = await createServer({
|
||||
root: fileURLToPath(new URL("../", import.meta.url)), logLevel: "silent",
|
||||
server: { host: "127.0.0.1", port: 0, hmr: false, ws: false },
|
||||
});
|
||||
t.after(() => server.close());
|
||||
await server.listen();
|
||||
const port = server.httpServer.address().port;
|
||||
const dom = await new Promise((resolve, reject) => {
|
||||
const child = spawn(chrome, ["--headless=new", "--no-sandbox", "--disable-gpu", "--disable-dev-shm-usage",
|
||||
"--virtual-time-budget=4000", "--dump-dom", `http://127.0.0.1:${port}/test/fixtures/opus-uplink-browser.html`]);
|
||||
let output = "", error = "";
|
||||
child.stdout.on("data", data => { output += data; });
|
||||
child.stderr.on("data", data => { error += data; });
|
||||
const timer = setTimeout(() => { child.kill(); reject(new Error("Browser timed out")); }, 30_000);
|
||||
child.on("error", err => { clearTimeout(timer); reject(err); });
|
||||
child.on("exit", () => { clearTimeout(timer); output.includes('id="result"') ? resolve(output) : reject(new Error(error)); });
|
||||
});
|
||||
const result = JSON.parse(dom.match(/<pre id="result"[^>]*>([\s\S]*?)<\/pre>/)[1].replaceAll(""", '"').replaceAll("&", "&"));
|
||||
assert.equal(result.error, undefined);
|
||||
assert.equal(result.initialized, true);
|
||||
assert.equal(result.before.active, true);
|
||||
assert.ok(result.before.frames > 0, JSON.stringify(result));
|
||||
assert.equal(result.after.active, true);
|
||||
assert.ok(result.after.frames > result.before.frames, JSON.stringify(result));
|
||||
assert.deepEqual(result.fallback, []);
|
||||
});
|
||||
@@ -9,15 +9,16 @@ function fakeUplink() {
|
||||
let dropped = 0;
|
||||
let configured = false;
|
||||
const encoder = {
|
||||
state: "configured" as const,
|
||||
state: "unconfigured" as "unconfigured" | "configured" | "closed",
|
||||
encodeQueueSize: 0,
|
||||
configure() { configured = true; },
|
||||
configure() { configured = true; this.state = "configured"; },
|
||||
encode(data: AudioData) {
|
||||
if (this.state !== "configured") throw new DOMException("Encoder is not configured", "InvalidStateError");
|
||||
encoded.push(data);
|
||||
output?.({ byteLength: 3, copyTo(target: Uint8Array) { target.set([1, 2, 3]); } });
|
||||
},
|
||||
reset() {},
|
||||
close() {},
|
||||
reset() { this.state = "unconfigured"; },
|
||||
close() { this.state = "closed"; },
|
||||
};
|
||||
const uplink = createOpusUplink({
|
||||
send(frame) { sent.push(frame); return true; },
|
||||
@@ -41,12 +42,21 @@ test("Opus uplink accumulates 960 samples, emits tagged frames and resets on VOX
|
||||
f.uplink.push(new Float32Array(480));
|
||||
assert.equal(f.encoded.length, 2);
|
||||
f.uplink.resetStream();
|
||||
assert.equal(f.encoder.state, "configured");
|
||||
f.uplink.push(new Float32Array(960));
|
||||
assert.equal(f.encoded.length, 3);
|
||||
f.uplink.disable();
|
||||
assert.equal(f.uplink.active, false);
|
||||
});
|
||||
|
||||
test("an encoder error partway through a large capture chunk exits the loop and falls back", async () => {
|
||||
const f = fakeUplink();
|
||||
await f.uplink.init();
|
||||
f.encoder.encode = () => { throw new DOMException("Encoding failed", "EncodingError"); };
|
||||
assert.equal(f.uplink.push(new Float32Array(4096)), false);
|
||||
assert.equal(f.uplink.active, false);
|
||||
});
|
||||
|
||||
test("Opus uplink cancels initialization when disabled during capability detection", async t => {
|
||||
const previousEncoder = globalThis.AudioEncoder;
|
||||
let resolveSupport!: (value: { supported: boolean }) => void;
|
||||
|
||||
@@ -146,6 +146,7 @@ function deferred() {
|
||||
|
||||
class TestPeer extends EventTarget {
|
||||
static instances = [];
|
||||
static connectOnAnswer = true;
|
||||
iceGatheringState = "complete";
|
||||
connectionState = "new";
|
||||
localDescription = null;
|
||||
@@ -156,7 +157,13 @@ class TestPeer extends EventTarget {
|
||||
getSenders() { return [this.sender]; }
|
||||
async createOffer() { return { type: "offer", sdp: "test-offer" }; }
|
||||
async setLocalDescription(description) { this.localDescription = description; }
|
||||
async setRemoteDescription(description) { this.remoteDescription = description; }
|
||||
async setRemoteDescription(description) {
|
||||
this.remoteDescription = description;
|
||||
if (TestPeer.connectOnAnswer) {
|
||||
this.connectionState = "connected";
|
||||
this.onconnectionstatechange?.();
|
||||
}
|
||||
}
|
||||
close() { this.connectionState = "closed"; }
|
||||
}
|
||||
|
||||
@@ -206,6 +213,7 @@ beforeEach(() => {
|
||||
compatibilityAudioClientId = 7;
|
||||
TestSocket.instances.length = 0;
|
||||
TestPeer.instances.length = 0;
|
||||
TestPeer.connectOnAnswer = true;
|
||||
AudioContextStub.processors.length = 0;
|
||||
AudioContextStub.instances.length = 0;
|
||||
AudioContextStub.sources.length = 0;
|
||||
@@ -748,11 +756,15 @@ test("channel traversal preserves sibling predecessors and handles a deep direct
|
||||
assert.equal(deep.channelTree.value.at(-1).depth, 4_999);
|
||||
});
|
||||
|
||||
async function connectWebRtc() {
|
||||
async function connectWebRtc({ negotiateOnly = false } = {}) {
|
||||
const socket = await connect();
|
||||
socket.receive({ type: "connected", tsClientId: 1, webrtcAvailable: true });
|
||||
await nextTurn();
|
||||
assert.ok(socket.messages.some(message => message.type === "webrtcOffer"));
|
||||
if (!negotiateOnly) {
|
||||
socket.receive({ type: "webrtcAnswer", payload: { sdp: { type: "answer", sdp: "connected-answer" } } });
|
||||
await nextTurn();
|
||||
}
|
||||
return { socket, peer: TestPeer.instances.at(-1) };
|
||||
}
|
||||
|
||||
@@ -1539,6 +1551,28 @@ test("a successful old WebRTC answer cannot activate WebRTC for a replacement co
|
||||
assert.ok(current.messages.some(message => message instanceof ArrayBuffer && message.byteLength === 1920));
|
||||
});
|
||||
|
||||
test("an answer without connected media keeps compatibility audio and a retry can time out", async t => {
|
||||
const deadlines = [];
|
||||
const setTimer = window.setTimeout.bind(window);
|
||||
t.mock.method(window, "setTimeout", (callback, ms) => {
|
||||
if (ms === 15_000) deadlines.push(callback);
|
||||
return setTimer(callback, ms);
|
||||
});
|
||||
TestPeer.connectOnAnswer = false;
|
||||
const {socket,peer} = await connectWebRtc({ negotiateOnly: true });
|
||||
peer.connectionState = "connecting";
|
||||
socket.receive({type:"webrtcAnswer",payload:{sdp:{type:"answer",sdp:"no-media"}}});
|
||||
await nextTurn();
|
||||
assertCompatibilityAudio(socket);
|
||||
assert.equal((await audioSample(socket)).transport, "negotiating");
|
||||
assert.equal(deadlines.length, 1);
|
||||
deadlines[0]();
|
||||
await nextTurn();
|
||||
assert.equal(peer.connectionState, "closed");
|
||||
assert.match(voice.state.audioNotice, /WEBRTC_CONNECTION_TIMEOUT/);
|
||||
assertCompatibilityAudio(socket);
|
||||
});
|
||||
|
||||
test("reconnect WebRTC keeps compatibility audio until ready without reconnecting TeamSpeak", async () => {
|
||||
const getUserMedia = navigator.mediaDevices.getUserMedia;
|
||||
let microphoneRequests = 0;
|
||||
@@ -1567,9 +1601,16 @@ test("reconnect WebRTC keeps compatibility audio until ready without reconnectin
|
||||
assert.equal(voice.state.webrtcReconnecting, true);
|
||||
assert.equal(voice.state.audioNoticeCode, "WEBRTC_FAILED");
|
||||
assertCompatibilityAudio(socket);
|
||||
TestPeer.connectOnAnswer = false;
|
||||
socket.receive({ type: "webrtcAnswer", payload: { sdp: { type: "answer", sdp: "reconnected-answer" } } });
|
||||
await nextTurn();
|
||||
assert.equal(current.remoteDescription.sdp, "reconnected-answer");
|
||||
assert.equal(voice.state.webrtcReconnecting, true);
|
||||
assert.equal(voice.state.audioNoticeCode, "WEBRTC_FAILED");
|
||||
assertCompatibilityAudio(socket);
|
||||
current.connectionState = "connected";
|
||||
current.onconnectionstatechange();
|
||||
await nextTurn();
|
||||
assert.equal(voice.state.webrtcReconnecting, false);
|
||||
assert.equal(voice.state.audioNoticeCode, "");
|
||||
assert.equal(voice.state.connected, true);
|
||||
@@ -1969,7 +2010,7 @@ test("a probe started before peer allocation cannot survive a failed transport a
|
||||
});
|
||||
|
||||
test("disconnect clears the WebRTC answer deadline immediately", async () => {
|
||||
await connectWebRtc();
|
||||
await connectWebRtc({ negotiateOnly: true });
|
||||
assert.ok(browserTimers.size > 0);
|
||||
voice.disconnect();
|
||||
assert.equal(browserTimers.size, 0);
|
||||
@@ -2019,7 +2060,7 @@ test("an answer timeout keeps the session and offers a WebRTC retry", async t =>
|
||||
if (ms === 8_000) deadlines.push(callback);
|
||||
return setTimer(callback, ms);
|
||||
});
|
||||
const { socket, peer } = await connectWebRtc();
|
||||
const { socket, peer } = await connectWebRtc({ negotiateOnly: true });
|
||||
assert.equal(deadlines.length, 1);
|
||||
deadlines[0]();
|
||||
await nextTurn();
|
||||
|
||||
Reference in new issue
Block a user