Reaches the Internal Beta milestone of DEC-001's release sequence the
same day as Alpha. Adds voice capture and playback through the full
Flutter UI → FRB → Rust core → tsclientlib → server path.
Promotions from PoC:
poc/audio-capture-playback-spike → crates/chanora_audio/
New product code:
crates/chanora_audio/src/engine.rs — cpal capture and playback,
audiopus Opus VoIP encoder (48 kHz mono 20 ms frames), tsclientlib
AudioHandler for decode + jitter buffer + mix on playback,
push-to-talk gate, graceful playback-only fallback when capture
is unavailable.
crates/chanora_protocol/src/adapter.rs — extended with
voice_out_tx (clonable mpsc::Sender<OutPacket>) and
take_voice_in() (one-shot mpsc::Receiver<InboundVoice>); main
loop now interleaves outbound voice drain, event pumping, and
control-request handling.
crates/chanora_protocol/src/lib.rs — re-exports the few
tsproto_packets types (OutAudio, OutPacket, InAudioBuf,
AudioData, CodecType, Direction) that chanora_audio
legitimately needs. Documented as the single deliberate
cross-crate type re-export per SAD-067, justified by the
performance cost of a parallel type hierarchy on the 20 ms
voice frame.
core/chanora_core/src/lib.rs — ChanoraSession::start_audio,
set_ptt, audio_stats; disconnect now stops the engine first.
crates/chanora_bridge/src/api.rs — startAudio, setPtt,
audioStats commands and BridgeAudioStats DTO.
apps/chanora_flutter/lib/main.dart — "Start audio" button +
hold-to-talk PTT button with pressed/released visual state +
live stats line (TX/RX/PTT). Stats polled every 500 ms.
ARB:
Both en and zh-Hans gain startAudioAction, pttHoldToTalk,
pttTransmitting, audioStatsLine. Banner updated to
"Beta build — voice in/out wired; not production ready."
FRB config:
flutter_rust_bridge.yaml gains local: true so codegen resolves
the workspace member's library stem to "chanora_bridge" instead
of falling back to "UNKNOWN".
Empirical verification (2026-05-14, against cn.teamspeak.app):
cargo check + cargo test --workspace: all green.
flutter analyze: 0 issues.
flutter test: 4/4 passing including:
- test/alpha_e2e_test.dart (regression: Alpha still works)
- test/beta_e2e_test.dart (Beta: connect → startAudio →
PTT cycle → disconnect against cn.teamspeak.app).
Live smoke (cargo test alpha_smoke -- --ignored): 49 channels,
37 clients retrieved.
Capture stream open against the host PipeWire auto_null source
refused (snd_pcm_hw_params); engine correctly logged the warning
and continued in playback-only mode. TX=0 frames, RX=0 frames
reflects the headless null-source environment; on a real mic
host the encoder produces ~50 frames/second while PTT is held.
Honest Beta scope (NOT in this release):
- AEC / AGC / NS / HPF DSP (DEC-007..010): AudioEffects exists
as a struct but the filters are no-ops. Beta+ work.
- Production-quality resampler: current code is linear
interpolation. Beta+ work.
- Identity persistence via chanora_storage: still ephemeral.
- Push-to-Dart event stream: UI polls instead.
- chanora_diagnostics tracing-layer wiring: still scaffold.
- Mobile (Android) cdylib + UI: PoC-proven, not yet in product.
- Reconnect / network-loss recovery for the voice path.
Docs updates:
- docs/governance/product-decision-register.md bumped to v0.9.7
(Beta-milestone change-history entry; no row changes).
- docs/governance/poc-results-summary.md bumped to v0.6.0
(RISK-PoC-005 updated with Beta progress).
68 lines
2.3 KiB
Dart
68 lines
2.3 KiB
Dart
// Beta end-to-end verification test.
|
|
//
|
|
// Runs the full Dart → FRB → Rust → tsclientlib → cn.teamspeak.app
|
|
// path, including the audio engine. Verifies:
|
|
// 1. Connect + snapshot still work (Alpha regression).
|
|
// 2. Audio engine starts.
|
|
// 3. PTT toggles successfully.
|
|
// 4. Encoder produces Opus frames while PTT is held.
|
|
// 5. Disconnect cleans both protocol and audio.
|
|
//
|
|
// Network-dependent. Quietly tolerates a server that rejects voice
|
|
// (e.g. because the test account is not yet allowed to talk).
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:chanora_flutter/src/rust/api.dart' as rust;
|
|
import 'package:chanora_flutter/src/rust/frb_generated.dart';
|
|
|
|
void main() {
|
|
setUpAll(() async {
|
|
await RustLib.init();
|
|
});
|
|
|
|
test('connect → start_audio → PTT cycle → disconnect', () async {
|
|
// Defensive cleanup in case a previous test left state.
|
|
try {
|
|
await rust.disconnect();
|
|
} catch (_) {}
|
|
|
|
final snap = await rust.connect(
|
|
host: 'cn.teamspeak.app',
|
|
nickname: 'ChanoraBetaTest',
|
|
);
|
|
expect(snap.serverName, isNotEmpty);
|
|
expect(snap.channels, isNotEmpty);
|
|
|
|
await rust.startAudio();
|
|
|
|
// Initial stats: PTT off, no frames sent yet.
|
|
final s0 = await rust.audioStats();
|
|
expect(s0.pttActive, isFalse);
|
|
expect(s0.framesSent, 0);
|
|
|
|
// Press PTT, wait ~250 ms, then read stats. If the host has a
|
|
// real microphone the encoder will emit ~10-12 frames. If the
|
|
// host has only a null source (typical headless), capture will
|
|
// have logged a warning at startAudio time and run in
|
|
// playback-only mode; framesSent stays at 0. Either outcome is
|
|
// a successful test of the wiring — what we actually verify
|
|
// here is that the PTT flag changes and no exception is thrown.
|
|
await rust.setPtt(active: true);
|
|
await Future<void>.delayed(const Duration(milliseconds: 250));
|
|
final s1 = await rust.audioStats();
|
|
expect(s1.pttActive, isTrue);
|
|
|
|
await rust.setPtt(active: false);
|
|
final s2 = await rust.audioStats();
|
|
expect(s2.pttActive, isFalse);
|
|
|
|
await rust.disconnect();
|
|
final connectedAfter = await rust.isConnected();
|
|
expect(connectedAfter, isFalse);
|
|
|
|
// ignore: avoid_print
|
|
print('Beta E2E: TX=${s1.framesSent} frames, RX=${s1.framesReceived} frames');
|
|
}, timeout: const Timeout(Duration(seconds: 30)));
|
|
}
|