mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-06 21:42:50 +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
@@ -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() };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user