2 Commits
Author SHA1 Message Date
omar 0923b32841 Transmit race tests: settle with setImmediate (fixture timers are unreferenced; Node 22 ended the loop)
ci / linux-x64 (push) Successful in 2m48s
ci / linux-arm64-cross (push) Successful in 2m48s
release / linux-arm64 (push) Successful in 6m21s
release / linux-x64 (push) Successful in 6m51s
release / appimage-startup (push) Successful in 14s
release / publish (push) Successful in 19s
2026-10-24 09:50:56 +03:00
omar 3d623329b3 Transmit mode: only the latest set_transmit answer counts; forwarding terminology; 0.1.4
ci / linux-x64 (push) Failing after 33s
ci / linux-arm64-cross (push) Successful in 3m8s
An older answer (same settings or a restarted core) could re-enable forwarding while a newer mode
change was pending. Requests and core restarts now start a new epoch. Renderer stats count frames
forwarded to the core. v0.1.3 was tagged but never released.
2026-10-24 09:45:49 +03:00
17 changed files with 176 additions and 75 deletions

No files matched your search

+9 -3
View File
@@ -1,6 +1,10 @@
# Changelog # Changelog
## 0.1.3 — unreleased ## 0.1.4 — unreleased
Version 0.1.3 was tagged but never released: a race in the transmit-mode handshake was found before
publication (an older answer could re-enable forwarding while a newer mode change was still pending). It is
fixed here.
- Added voice activation as a third transmission mode next to push to talk and the open microphone - Added voice activation as a third transmission mode next to push to talk and the open microphone
(Settings → Audio → Voice transmission, sensitivity High / Normal / Low). The core decides locally with (Settings → Audio → Voice transmission, sensitivity High / Normal / Low). The core decides locally with
@@ -14,8 +18,10 @@
stored settings keep their mode, and new profiles still start with push to talk. stored settings keep their mode, and new profiles still start with push to talk.
- The transmission mode moved from Settings → Keyboard to Settings → Audio; the push-to-talk key stays in - The transmission mode moved from Settings → Keyboard to Settings → Audio; the push-to-talk key stays in
Keyboard. The microphone test explains that it only shows the input level and never transmits. Keyboard. The microphone test explains that it only shows the input level and never transmits.
- The renderer forwards microphone audio only after the core has confirmed the selected mode; a failed - The renderer forwards microphone audio only after the core has confirmed the selected mode; only the
mode change is shown and nothing is sent until it is applied. answer to the latest request counts (older answers, also from a restarted core, are ignored), and a failed
mode change is shown and nothing is sent until it is applied. Renderer diagnostics now count frames
forwarded to the core, not "sent" frames; whether voice is sent is the core's transmitting state.
- Fixed: a preference write failure no longer changes the in-memory value the app keeps using. - Fixed: a preference write failure no longer changes the in-memory value the app keeps using.
- ARM64 CI runs the core unit tests (voice detector, resampler, identity, codecs) under qemu-aarch64 - ARM64 CI runs the core unit tests (voice detector, resampler, identity, codecs) under qemu-aarch64
(emulated, not native hardware). (emulated, not native hardware).
+1 -1
View File
@@ -14,7 +14,7 @@ UI, evidence path given; **implemented** = code + unit/loopback tests, no live p
| Server password on connect | implemented, not exercised | the test server has no password | | Server password on connect | implemented, not exercised | the test server has no password |
| Channel tree, join channel, password channels (inline prompt) | proven (join), implemented (password) | probe joined `cs`; no password test performed | | Channel tree, join channel, password channels (inline prompt) | proven (join), implemented (password) | probe joined `cs`; no password test performed |
| Voice TX/RX (Opus via core), talking indicators, mute, deafen RX+TX block/restore, PTT, open mic | proven between two TeamsPeach clients with synthetic capture | `docs/evidence/runtime/2026-10-24-voice-chat/`; the path after capture is real. Live microphone voice with the official TS6 client and Asahi hardware operation are not proven | | Voice TX/RX (Opus via core), talking indicators, mute, deafen RX+TX block/restore, PTT, open mic | proven between two TeamsPeach clients with synthetic capture | `docs/evidence/runtime/2026-10-24-voice-chat/`; the path after capture is real. Live microphone voice with the official TS6 client and Asahi hardware operation are not proven |
| Voice activation (local voice detector in the core, sensitivity High/Normal/Low, 100 ms preroll, 400 ms hangover) | proven between two TeamsPeach clients with a real speech recording as file-fed capture; detector unit tests on real speech and synthetic noise | `docs/evidence/runtime/2026-10-24-vad-dev/`, `docs/evidence/vad-0.1.3.md`: speech opens and silence closes the gate, mute/deafen/push-to-talk-not-held/disconnected send nothing, setting persists. A live microphone, an official TS6 receiver and native ARM64 hardware are not proven (ARM64 unit tests run under qemu) | | Voice activation (local voice detector in the core, sensitivity High/Normal/Low, 100 ms preroll, 400 ms hangover) | proven between two TeamsPeach clients with a real speech recording as file-fed capture; detector unit tests on real speech and synthetic noise | `docs/evidence/runtime/2026-10-24-vad-dev/`, `docs/evidence/vad-0.1.4.md`: speech opens and silence closes the gate, mute/deafen/push-to-talk-not-held/disconnected send nothing, setting persists. A live microphone, an official TS6 receiver and native ARM64 hardware are not proven (ARM64 unit tests run under qemu) |
| Private chat | proven | voice-chat run `15/16-*.png` | | Private chat | proven | voice-chat run `15/16-*.png` |
| Channel chat | proven error path | server denies guests: TS 2568, permission 224, shown in UI | | Channel chat | proven error path | server denies guests: TS 2568, permission 224, shown in UI |
| Server chat | implemented | not exercised live | | Server chat | implemented | not exercised live |
+1 -1
View File
@@ -472,7 +472,7 @@ Object.defineProperty(window, 'teamspeachDiagnostics', {
clients: S.snap ? S.snap.clients.map((c) => ({ id: c.id, nickname: c.nickname, channel: c.channel_id, type: c.client_type, inputMuted: c.input_muted })) : [], clients: S.snap ? S.snap.clients.map((c) => ({ id: c.id, nickname: c.nickname, channel: c.channel_id, type: c.client_type, inputMuted: c.input_muted })) : [],
talking: Array.from(S.talking), talking: Array.from(S.talking),
audio: { ...S.audio }, audio: { ...S.audio },
voice: { ...voice.voiceStats, sending: voice.isSending(), capturing: voice.isCapturing(), coreMode: voice.confirmedTransmitMode() }, voice: { ...voice.voiceStats, forwarding: voice.isForwarding(), capturing: voice.isCapturing(), coreMode: voice.confirmedTransmitMode() },
streams: Array.from(watch.directory.streams.values()).map((s) => ({ id: s.id, clientId: s.clientId, name: s.name })), streams: Array.from(watch.directory.streams.values()).map((s) => ({ id: s.id, clientId: s.clientId, name: s.name })),
watch: { ...watch.watchStats }, watch: { ...watch.watchStats },
videoCodecs: settings.videoCodecs(), videoCodecs: settings.videoCodecs(),
+42 -30
View File
@@ -9,11 +9,12 @@ import { toast } from './toast.js';
import { errorText, keyLabel } from './text.js'; import { errorText, keyLabel } from './text.js';
import { t } from './i18n.js'; import { t } from './i18n.js';
export const voiceStats = { framesSent: 0, bursts: 0, framesPlayed: 0, level: 0 }; // framesForwarded counts PCM frames handed to the core; whether voice was sent is S.audio.transmitting.
export const voiceStats = { framesForwarded: 0, forwardRuns: 0, framesPlayed: 0, level: 0 };
let engine = null; let engine = null;
let sending = false; let forwarding = false;
let burst = null; let forwardRun = null;
let micTest = false; let micTest = false;
let meterRaf = 0; let meterRaf = 0;
let assigningPtt = null; let assigningPtt = null;
@@ -84,7 +85,11 @@ function channelCanTransmit() {
// "direct": the core sends every forwarded frame (push to talk, open microphone). "vad": the core's voice // "direct": the core sends every forwarded frame (push to talk, open microphone). "vad": the core's voice
// detector decides, so frames are forwarded continuously and only speech is sent. // detector decides, so frames are forwarded continuously and only speech is sent.
let coreTx = null; let coreTx = null;
let coreTxPending = null; // Every request and every core restart bumps the epoch; only the answer to the latest request may change
// coreTx, so an older answer (even for the same settings, or from a previous core) never re-enables
// forwarding while a newer change is still on its way.
let coreTxEpoch = 0;
let coreTxPendingKey = null;
let coreTxFailed = false; let coreTxFailed = false;
function wantedCoreTx() { function wantedCoreTx() {
@@ -93,13 +98,13 @@ function wantedCoreTx() {
const txKey = (mode) => (mode ? `${mode.mode}:${mode.sensitivity ?? ''}` : ''); const txKey = (mode) => (mode ? `${mode.mode}:${mode.sensitivity ?? ''}` : '');
/** Stops forwarding at once and ends an open burst (the core ends its talk spurt on audio_end). */ /** Stops forwarding at once (audio_end: the core ends any talk spurt and, in voice activation, forgets the audio). */
function stopForwarding() { function stopForwarding() {
if (!sending) return; if (!forwarding) return;
tp.endAudio(); tp.endAudio();
sending = false; forwarding = false;
log('debug', `voice: burst end frames=${burst.frames} peak=${burst.peakMax > 0 ? (20 * Math.log10(burst.peakMax)).toFixed(1) : '-inf'} dBFS`); log('debug', `voice: forwarding end frames=${forwardRun.frames} peak=${forwardRun.peakMax > 0 ? (20 * Math.log10(forwardRun.peakMax)).toFixed(1) : '-inf'} dBFS`);
burst = null; forwardRun = null;
hooks.onTransmitChanged(); hooks.onTransmitChanged();
} }
@@ -112,33 +117,39 @@ export async function applyTransmitMode() {
if (!S.prefs) return; if (!S.prefs) return;
const want = wantedCoreTx(); const want = wantedCoreTx();
const key = txKey(want); const key = txKey(want);
if (txKey(coreTx) === key && !coreTxFailed) return; if (coreTxPendingKey === key) return; // the latest request already asks for exactly this
if (coreTxPendingKey === null && txKey(coreTx) === key && !coreTxFailed) return;
const epoch = ++coreTxEpoch;
coreTx = null; coreTx = null;
coreTxFailed = false;
stopForwarding(); stopForwarding();
coreTxPending = key; coreTxPendingKey = key;
try { try {
const result = await call('set_transmit', want); const result = await call('set_transmit', want);
if (coreTxPending !== key) return; // a newer change is on its way if (epoch !== coreTxEpoch) return; // superseded, or the core restarted
coreTx = { mode: result.mode, sensitivity: result.sensitivity }; coreTx = { mode: result.mode, sensitivity: result.sensitivity };
coreTxFailed = false;
log('info', `voice: transmit mode ${result.mode}${result.sensitivity ? ` (${result.sensitivity})` : ''}`); log('info', `voice: transmit mode ${result.mode}${result.sensitivity ? ` (${result.sensitivity})` : ''}`);
} catch (err) { } catch (err) {
if (coreTxPending !== key) return; if (epoch !== coreTxEpoch) return;
coreTxFailed = true; coreTxFailed = true;
log('error', `voice: set_transmit failed: ${err.code} ${err.message}`); log('error', `voice: set_transmit failed: ${err.code} ${err.message}`);
toast(() => t('error.transmit_mode', { detail: errorText(err) }), 'error'); toast(() => t('error.transmit_mode', { detail: errorText(err) }), 'error');
} finally { } finally {
if (coreTxPending === key) coreTxPending = null; if (epoch === coreTxEpoch) {
hooks.onTransmitChanged(); coreTxPendingKey = null;
hooks.onTransmitChanged();
}
} }
} }
/** The core stopped or restarted: its transmit mode is unknown until applied again. */ /** The core stopped or restarted: its transmit mode is unknown, and answers from before are void. */
export function forgetCoreTransmitMode() { export function forgetCoreTransmitMode() {
coreTxEpoch += 1;
coreTx = null; coreTx = null;
coreTxPending = null; coreTxPendingKey = null;
sending = false; coreTxFailed = false;
burst = null; forwarding = false;
forwardRun = null;
} }
/** Whether captured frames go to the core right now (not whether voice is sent: see S.audio.transmitting). */ /** Whether captured frames go to the core right now (not whether voice is sent: see S.audio.transmitting). */
@@ -155,16 +166,16 @@ function onFrame(pcm, rms, peak) {
if (micTest && !meterRaf) meterRaf = requestAnimationFrame(drawMeter); if (micTest && !meterRaf) meterRaf = requestAnimationFrame(drawMeter);
if (shouldForward()) { if (shouldForward()) {
tp.sendAudioFrame(new Uint8Array(pcm)); tp.sendAudioFrame(new Uint8Array(pcm));
voiceStats.framesSent += 1; voiceStats.framesForwarded += 1;
if (!sending) { if (!forwarding) {
sending = true; forwarding = true;
voiceStats.bursts += 1; voiceStats.forwardRuns += 1;
burst = { frames: 0, peakMax: 0, mode: S.prefs.transmitMode }; forwardRun = { frames: 0, peakMax: 0, mode: S.prefs.transmitMode };
log('debug', `voice: burst start mode=${burst.mode} focused=${document.hasFocus()} capture=${engine.capturing}`); log('debug', `voice: forwarding start mode=${forwardRun.mode} focused=${document.hasFocus()} capture=${engine.capturing}`);
hooks.onTransmitChanged(); hooks.onTransmitChanged();
} }
burst.frames += 1; forwardRun.frames += 1;
if (peak > burst.peakMax) burst.peakMax = peak; if (peak > forwardRun.peakMax) forwardRun.peakMax = peak;
} else { } else {
stopForwarding(); stopForwarding();
} }
@@ -362,8 +373,9 @@ export function confirmedTransmitMode() {
return coreTx ? { ...coreTx } : null; return coreTx ? { ...coreTx } : null;
} }
export function isSending() { /** Whether captured PCM is currently being handed to the core (not whether voice is sent). */
return sending; export function isForwarding() {
return forwarding;
} }
export function channelCodecProblem() { export function channelCodecProblem() {
+1 -1
View File
@@ -1875,7 +1875,7 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
[[package]] [[package]]
name = "teamspeach-core" name = "teamspeach-core"
version = "0.1.3" version = "0.1.4"
dependencies = [ dependencies = [
"audiopus", "audiopus",
"base64 0.22.1", "base64 0.22.1",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "teamspeach-core" name = "teamspeach-core"
version = "0.1.3" version = "0.1.4"
edition = "2021" edition = "2021"
rust-version = "1.89" rust-version = "1.89"
description = "TeamsPeach native TeamSpeak protocol core (stdio JSON bridge)" description = "TeamsPeach native TeamSpeak protocol core (stdio JSON bridge)"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

@@ -1,16 +1,21 @@
{ {
"startedAt": "2026-10-24T06:25:21.850Z", "startedAt": "2026-10-24T06:44:19.203Z",
"server": "10.10.10.160:9987", "server": "10.10.10.160:9987",
"steps": [ "steps": [
{
"name": "build",
"at": "2026-10-24T06:44:19.206Z",
"exe": "dev tree"
},
{ {
"name": "input", "name": "input",
"at": "2026-10-24T06:25:21.852Z", "at": "2026-10-24T06:44:19.206Z",
"file": "silence 2 s + speech-librivox-48k.wav (4 s) + silence 3 s, looped", "file": "silence 2 s + speech-librivox-48k.wav (4 s) + silence 3 s, looped",
"seconds": 9 "seconds": 9
}, },
{ {
"name": "A voice activation confirmed by the core", "name": "A voice activation confirmed by the core",
"at": "2026-10-24T06:25:24.624Z", "at": "2026-10-24T06:44:21.705Z",
"coreMode": { "coreMode": {
"mode": "vad", "mode": "vad",
"sensitivity": "normal" "sensitivity": "normal"
@@ -18,29 +23,29 @@
}, },
{ {
"name": "both connected, channel empty otherwise", "name": "both connected, channel empty otherwise",
"at": "2026-10-24T06:25:27.832Z", "at": "2026-10-24T06:44:24.984Z",
"channel": "Welcome to the club buddy" "channel": "Welcome to the club buddy"
}, },
{ {
"name": "speech and silence", "name": "speech and silence",
"at": "2026-10-24T06:25:46.339Z", "at": "2026-10-24T06:44:43.544Z",
"spurts": 6, "spurts": 6,
"onMs": [ "onMs": [
738, 748,
1979, 1922,
622, 683,
744, 745,
1975, 1919,
556 623
], ],
"offMs": [ "offMs": [
1305, 1300,
0, 0,
556, 563,
4732, 4710,
0, 62,
561, 557,
3927 3920
], ],
"onFraction": 0.36, "onFraction": 0.36,
"bHeardA": true, "bHeardA": true,
@@ -51,34 +56,34 @@
}, },
{ {
"name": "muted: nothing sent", "name": "muted: nothing sent",
"at": "2026-10-24T06:25:55.427Z", "at": "2026-10-24T06:44:52.666Z",
"transmitted": false, "transmitted": false,
"bReceivedFrames": 0 "bReceivedFrames": 0
}, },
{ {
"name": "deafened: nothing sent", "name": "deafened: nothing sent",
"at": "2026-10-24T06:26:04.472Z", "at": "2026-10-24T06:45:01.745Z",
"transmitted": false, "transmitted": false,
"bReceivedFrames": 0 "bReceivedFrames": 0
}, },
{ {
"name": "push to talk not held: nothing sent", "name": "push to talk not held: nothing sent",
"at": "2026-10-24T06:26:13.579Z", "at": "2026-10-24T06:45:10.854Z",
"transmitted": false, "transmitted": false,
"bReceivedFrames": 0 "bReceivedFrames": 0
}, },
{ {
"name": "voice activation again: speech sent", "name": "voice activation again: speech sent",
"at": "2026-10-24T06:26:14.191Z" "at": "2026-10-24T06:45:11.333Z"
}, },
{ {
"name": "disconnected", "name": "disconnected",
"at": "2026-10-24T06:26:17.261Z", "at": "2026-10-24T06:45:14.413Z",
"transmitted": false "transmitted": false
}, },
{ {
"name": "restart: voice activation persisted and confirmed", "name": "restart: voice activation persisted and confirmed",
"at": "2026-10-24T06:26:18.635Z", "at": "2026-10-24T06:45:15.633Z",
"transmitMode": "vad", "transmitMode": "vad",
"vadSensitivity": "normal", "vadSensitivity": "normal",
"coreMode": { "coreMode": {
@@ -1,4 +1,4 @@
# 0.1.3 voice activation: design, measurements, limits # 0.1.4 voice activation: design, measurements, limits
## What it is ## What it is
A third transmission mode. The renderer forwards 20 ms frames (48 kHz mono) to the core continuously while A third transmission mode. The renderer forwards 20 ms frames (48 kHz mono) to the core continuously while
@@ -30,7 +30,10 @@ frame is sent). There is one decision owner per mode: the renderer for `direct`,
`set_transmit` is answered only after the core discarded frames queued under the previous mode (control `set_transmit` is answered only after the core discarded frames queued under the previous mode (control
messages use a separate channel and are not affected) and ended any open burst. The renderer forwards nothing messages use a separate channel and are not affected) and ended any open burst. The renderer forwards nothing
until the answer matches the preferences; a failed change shows an error and sends nothing (never open until the answer matches the preferences; a failed change shows an error and sends nothing (never open
microphone). Mute, deafen and disconnect stop forwarding immediately. The own "talking" indicator is the core's microphone). Only the answer to the latest request counts: every request and every core restart starts a new
epoch, so an older answer (also for the same settings, or from a previous core) cannot re-enable forwarding
while a newer change is pending (tests: out-of-order vad → direct → vad answers; answers from a restarted core).
Mute, deafen and disconnect stop forwarding immediately. The own "talking" indicator is the core's
`audio_state.transmitting`, true only while voice packets are sent. Tests: `test/voice-transmit.test.mjs`. `audio_state.transmitting`, true only while voice packets are sent. Tests: `test/voice-transmit.test.mjs`.
## Measurements (deterministic unit tests, `cargo test`, x64 Windows) ## Measurements (deterministic unit tests, `cargo test`, x64 Windows)
+1 -1
View File
@@ -61,7 +61,7 @@ The isolated smoke does not establish live-server call or active-stream continui
The targeted command above passed **14/14 tests**. The real Electron smoke passed with no renderer page errors on Electron 44.9.3 / Windows x64: fresh-profile English, all seven categories and both actual-device context menus in both languages, live notification translation, Russian persistence after restart, and switching back to English. Capture remained off, the UID/nickname and unrelated preferences stayed unchanged, and the connection-form draft survived. No horizontal document overflow was detected at 880×560. The generated result and matching English/Russian screenshots are under `docs/evidence/runtime/i18n-2026-10-24/`; the temporary profile was deleted. Screenshots show disposable smoke identity data and real OS-provided device labels, not an owner's identity or server data. The targeted command above passed **14/14 tests**. The real Electron smoke passed with no renderer page errors on Electron 44.9.3 / Windows x64: fresh-profile English, all seven categories and both actual-device context menus in both languages, live notification translation, Russian persistence after restart, and switching back to English. Capture remained off, the UID/nickname and unrelated preferences stayed unchanged, and the connection-form draft survived. No horizontal document overflow was detected at 880×560. The generated result and matching English/Russian screenshots are under `docs/evidence/runtime/i18n-2026-10-24/`; the temporary profile was deleted. Screenshots show disposable smoke identity data and real OS-provided device labels, not an owner's identity or server data.
### Voice activation settings, 0.1.3 development UI ### Voice activation settings, 0.1.4 development UI
The single transmission-mode selector is in Settings → Audio: push to talk, voice activation, or an explicitly continuous open microphone. Keyboard retains the push-to-talk key binding. The `transmit.*` messages distinguish local speech detection from the input-level meter, recording, and speech recognition/transcription. They describe the approximate 0.4-second transmission tail and explain that noise suppression cannot guarantee rejection of television audio, other voices, or noise. `error.transmit_mode` retains the same `{detail}` placeholder in both catalogs. The single transmission-mode selector is in Settings → Audio: push to talk, voice activation, or an explicitly continuous open microphone. Keyboard retains the push-to-talk key binding. The `transmit.*` messages distinguish local speech detection from the input-level meter, recording, and speech recognition/transcription. They describe the approximate 0.4-second transmission tail and explain that noise suppression cannot guarantee rejection of television audio, other voices, or noise. `error.transmit_mode` retains the same `{detail}` placeholder in both catalogs.
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "teamspeach", "name": "teamspeach",
"version": "0.1.3", "version": "0.1.4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "teamspeach", "name": "teamspeach",
"version": "0.1.3", "version": "0.1.4",
"license": "UNLICENSED", "license": "UNLICENSED",
"dependencies": { "dependencies": {
"electron-updater": "6.8.11", "electron-updater": "6.8.11",
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "teamspeach", "name": "teamspeach",
"productName": "TeamsPeach", "productName": "TeamsPeach",
"version": "0.1.3", "version": "0.1.4",
"description": "Desktop TeamSpeak 6 client: voice, chat and TS6 screenshare viewing", "description": "Desktop TeamSpeak 6 client: voice, chat and TS6 screenshare viewing",
"main": "app/main/main.js", "main": "app/main/main.js",
"private": true, "private": true,
+2 -2
View File
@@ -32,7 +32,7 @@ async function launch(label) {
const state = (page) => page.evaluate(() => ({ const state = (page) => page.evaluate(() => ({
audio: window.teamspeachDiagnostics.snapshot().audio, audio: window.teamspeachDiagnostics.snapshot().audio,
capturing: window.teamspeachDiagnostics.snapshot().voice.capturing, capturing: window.teamspeachDiagnostics.snapshot().voice.capturing,
framesSent: window.teamspeachDiagnostics.snapshot().voice.framesSent, framesForwarded: window.teamspeachDiagnostics.snapshot().voice.framesForwarded,
menu: Boolean(document.querySelector('.device-menu')), menu: Boolean(document.querySelector('.device-menu')),
items: Array.from(document.querySelectorAll('.device-menu [role="menuitemradio"]')).map((i) => ({ label: i.textContent, checked: i.getAttribute('aria-checked') })), items: Array.from(document.querySelectorAll('.device-menu [role="menuitemradio"]')).map((i) => ({ label: i.textContent, checked: i.getAttribute('aria-checked') })),
focused: document.activeElement?.id || document.activeElement?.className || '', focused: document.activeElement?.id || document.activeElement?.className || '',
@@ -52,7 +52,7 @@ try {
await page.click('#btn-mute', { button: 'right' }); await page.click('#btn-mute', { button: 'right' });
await page.waitForSelector('.device-menu [role="menuitemradio"]'); await page.waitForSelector('.device-menu [role="menuitemradio"]');
let s = await state(page); let s = await state(page);
step('mic right-click', { menu: s.menu, inputMuted: s.audio.input_muted, capturing: s.capturing, framesSent: s.framesSent, items: s.items, insideViewport: s.inside, focused: s.focused }); step('mic right-click', { menu: s.menu, inputMuted: s.audio.input_muted, capturing: s.capturing, framesForwarded: s.framesForwarded, items: s.items, insideViewport: s.inside, focused: s.focused });
if (s.audio.input_muted) throw new Error('right-click toggled mute'); if (s.audio.input_muted) throw new Error('right-click toggled mute');
await page.screenshot({ path: path.join(out, '62-mic-device-menu.png') }); await page.screenshot({ path: path.join(out, '62-mic-device-menu.png') });
const pick = s.items[Math.min(2, s.items.length - 1)].label; const pick = s.items[Math.min(2, s.items.length - 1)].label;
+3 -3
View File
@@ -38,7 +38,7 @@ const readSelects = (page) => page.evaluate(() => {
inputValueIsDevice: Boolean(document.querySelector('#input-device').value), inputValueIsDevice: Boolean(document.querySelector('#input-device').value),
outputValueIsDevice: Boolean(document.querySelector('#output-device').value), outputValueIsDevice: Boolean(document.querySelector('#output-device').value),
status: document.querySelector('#device-status').textContent, status: document.querySelector('#device-status').textContent,
framesSent: window.teamspeachDiagnostics.snapshot().voice.framesSent, framesForwarded: window.teamspeachDiagnostics.snapshot().voice.framesForwarded,
capturing: window.teamspeachDiagnostics.snapshot().voice.capturing, capturing: window.teamspeachDiagnostics.snapshot().voice.capturing,
conn: window.teamspeachDiagnostics.snapshot().conn, conn: window.teamspeachDiagnostics.snapshot().conn,
toasts: Array.from(document.querySelectorAll('.toast[data-kind="error"]')).map((t) => t.textContent), toasts: Array.from(document.querySelectorAll('.toast[data-kind="error"]')).map((t) => t.textContent),
@@ -58,7 +58,7 @@ try {
await page.click('#settings-nav .nav-item[data-panel="audio"]'); await page.click('#settings-nav .nav-item[data-panel="audio"]');
await page.waitForFunction(() => document.querySelector('#device-status').textContent.length > 0, null, { timeout: 10000 }); await page.waitForFunction(() => document.querySelector('#device-status').textContent.length > 0, null, { timeout: 10000 });
let s = await readSelects(page); let s = await readSelects(page);
step('listed without capture', { inputs: s.inputs.length - 1, outputs: s.outputs.length - 1, inputLabels: s.inputs.map((o) => o.label), outputLabels: s.outputs.map((o) => o.label), status: s.status, conn: s.conn, framesSent: s.framesSent, capturing: s.capturing }); step('listed without capture', { inputs: s.inputs.length - 1, outputs: s.outputs.length - 1, inputLabels: s.inputs.map((o) => o.label), outputLabels: s.outputs.map((o) => o.label), status: s.status, conn: s.conn, framesForwarded: s.framesForwarded, capturing: s.capturing });
await page.screenshot({ path: path.join(out, '60-audio-devices-listed.png') }); await page.screenshot({ path: path.join(out, '60-audio-devices-listed.png') });
if (s.inputs.length < 2 || s.outputs.length < 2) throw new Error('no physical devices listed'); if (s.inputs.length < 2 || s.outputs.length < 2) throw new Error('no physical devices listed');
@@ -69,7 +69,7 @@ try {
await page.selectOption('#output-device', { label: outputChoice }); await page.selectOption('#output-device', { label: outputChoice });
await page.waitForTimeout(1000); await page.waitForTimeout(1000);
s = await readSelects(page); s = await readSelects(page);
step('selected', { inputChoice, outputChoice, toasts: s.toasts, framesSent: s.framesSent, capturing: s.capturing }); step('selected', { inputChoice, outputChoice, toasts: s.toasts, framesForwarded: s.framesForwarded, capturing: s.capturing });
await app.close(); await app.close();
({ app, page } = await launch('run2')); ({ app, page } = await launch('run2'));
+1 -1
View File
@@ -105,7 +105,7 @@ try {
let sa = await diag(a.page); let sa = await diag(a.page);
let sb = await diag(b.page); let sb = await diag(b.page);
const playback = await b.page.evaluate(() => window.teamspeachDiagnostics.playback()); const playback = await b.page.evaluate(() => window.teamspeachDiagnostics.playback());
step('open mic received', { aFramesSent: sa.voice.framesSent, aTransmitting: sa.audio.transmitting, bTalking: sb.talking, bFramesPlayed: sb.voice.framesPlayed, bPlayback: playback }); step('open mic received', { aFramesForwarded: sa.voice.framesForwarded, aTransmitting: sa.audio.transmitting, bTalking: sb.talking, bFramesPlayed: sb.voice.framesPlayed, bPlayback: playback });
if (sb.voice.framesPlayed < 50) throw new Error('B received too few audio frames'); if (sb.voice.framesPlayed < 50) throw new Error('B received too few audio frames');
await b.page.screenshot({ path: path.join(out, '10-b-sees-a-talking.png') }); await b.page.screenshot({ path: path.join(out, '10-b-sees-a-talking.png') });
await a.page.screenshot({ path: path.join(out, '11-a-open-mic.png') }); await a.page.screenshot({ path: path.join(out, '11-a-open-mic.png') });
+1 -1
View File
@@ -5,7 +5,7 @@
// 4. the relaunched process reports the new version; its file matches the release feed's sha512; // 4. the relaunched process reports the new version; its file matches the release feed's sha512;
// 5. start the new AppImage again: version, UID, nickname, bookmark and device pref are unchanged. // 5. start the new AppImage again: version, UID, nickname, bookmark and device pref are unchanged.
// //
// xvfb-run -a node scripts/update-e2e.mjs --from <old.AppImage> --to-tag v0.1.3 --out update-e2e-out \ // xvfb-run -a node scripts/update-e2e.mjs --from <old.AppImage> --to-tag v0.1.4 --out update-e2e-out \
// [--new-prefs '{"transmitMode":"vad","vadSensitivity":"high"}'] // [--new-prefs '{"transmitMode":"vad","vadSensitivity":"high"}']
// //
// The old app stores non-default values it supports itself (transmitMode 'open', devices, …). --new-prefs are // The old app stores non-default values it supports itself (transmitMode 'open', devices, …). --new-prefs are
+77 -2
View File
@@ -53,7 +53,7 @@ test('push to talk forwards only while held, under the direct mode', () => {
voice.setPtt(false); voice.setPtt(false);
const ends = env.ended; const ends = env.ended;
assert.equal(forwarded(() => env.frame()), 0); assert.equal(forwarded(() => env.frame()), 0);
assert.equal(env.ended, ends + 1, 'releasing ends the burst'); assert.equal(env.ended, ends + 1, 'releasing ends forwarding');
}); });
test('switching to voice activation forwards nothing until "vad" is acknowledged', async () => { test('switching to voice activation forwards nothing until "vad" is acknowledged', async () => {
@@ -91,7 +91,7 @@ test('mute, deafen and disconnect stop forwarding at once', () => {
const ends = env.ended; const ends = env.ended;
set(); set();
assert.equal(forwarded(() => env.frame()), 0, `${name}: nothing forwarded`); assert.equal(forwarded(() => env.frame()), 0, `${name}: nothing forwarded`);
assert.equal(env.ended, ends + 1, `${name}: burst ended`); assert.equal(env.ended, ends + 1, `${name}: forwarding ended`);
unset(); unset();
} }
}); });
@@ -115,3 +115,78 @@ test('a core restart forgets the confirmed mode', async () => {
voice.forgetCoreTransmitMode(); voice.forgetCoreTransmitMode();
assert.equal(forwarded(() => env.frame()), 0); assert.equal(forwarded(() => env.frame()), 0);
}); });
/** Answers each set_transmit only when the test resolves it, in any order. */
function manualCore() {
const pending = [];
env.respond = (cmd, args) => {
if (cmd !== 'set_transmit') return Promise.resolve({ ok: true, result: {} });
return new Promise((resolve) => {
pending.push({
args,
ok: () => resolve({ ok: true, result: args.mode === 'vad' ? { mode: 'vad', sensitivity: args.sensitivity } : { mode: 'direct' } }),
fail: () => resolve({ ok: false, error: { code: 'internal', message: 'old core' } }),
});
});
};
return pending;
}
// setImmediate, not setTimeout: the fixture unreferences timers, and an unreferenced timer alone lets the event
// loop end before the pending answers are delivered (Node 22).
const settle = () => new Promise((r) => setImmediate(r));
test('out-of-order answers (vad → direct → vad): only the latest one enables forwarding', async () => {
const pending = manualCore();
S.prefs.transmitMode = 'vad';
S.prefs.vadSensitivity = 'normal';
const a1 = voice.applyTransmitMode();
S.prefs.transmitMode = 'open';
const b = voice.applyTransmitMode();
S.prefs.transmitMode = 'vad';
const a2 = voice.applyTransmitMode();
assert.deepEqual(pending.map((p) => p.args.mode), ['vad', 'direct', 'vad']);
// The core answers in order; the first "vad" answer matches the current settings but is not the latest.
pending[0].ok();
await settle();
assert.equal(forwarded(() => env.frame()), 0, 'stale vad answer while direct is still being applied');
pending[1].ok();
await settle();
assert.equal(forwarded(() => env.frame()), 0, 'intermediate direct answer');
pending[2].ok();
await Promise.all([a1, b, a2]);
assert.equal(forwarded(() => env.frame()), 1, 'latest answer');
assert.deepEqual(voice.confirmedTransmitMode(), { mode: 'vad', sensitivity: 'normal' });
});
test('an identical change already on its way is not requested twice', async () => {
const pending = manualCore();
S.prefs.vadSensitivity = 'high';
const first = voice.applyTransmitMode();
const second = voice.applyTransmitMode();
assert.equal(pending.length, 1);
pending[0].ok();
await Promise.all([first, second]);
assert.equal(forwarded(() => env.frame()), 1);
});
test('answers from a core that has since restarted are ignored', async () => {
let pending = manualCore();
S.prefs.transmitMode = 'open';
const old = voice.applyTransmitMode();
voice.forgetCoreTransmitMode(); // core restarted before answering
pending[0].ok();
await old;
assert.equal(forwarded(() => env.frame()), 0, 'old core success must not enable forwarding');
pending = manualCore();
const failing = voice.applyTransmitMode();
voice.forgetCoreTransmitMode();
pending[0].fail();
await failing;
// The new core is asked afresh and its answer applies.
pending = manualCore();
const fresh = voice.applyTransmitMode();
assert.equal(pending.length, 1);
pending[0].ok();
await fresh;
assert.equal(forwarded(() => env.frame()), 1);
});