feat(M1): TCP/TLS control plane -- auth, channels, ephemeral text
Implements the full M1 milestone. Two clients authenticate over TLS 1.3
(guest + Argon2id password) and exchange channel + private text messages
through a real server. All five ctest --preset m1-dev tests pass in ~1 s.
Key components added:
- vcpkg baseline + m1-dev preset (protobuf/mbedTLS/libsodium/asio/sqlite3)
- FrameCodec feed+emit, encode/decode_envelope, protobuf codegen
- TcpServerConn with blocking TLS handshake thread + tls_read_loop
- TlsContext (mbedTLS 1.3, ECDSA-P256 self-signed cert, TOFU on client)
- WorkerPool (3 threads, used for Argon2id)
- Database: SQLite + libsodium Argon2id, account lifecycle, bootstrap admin
- ServerIdentityManager: Ed25519 key + cert generate/persist/fingerprint
- ConnSession state machine: WaitingHello -> WaitingAuth -> Authenticated
- SessionRegistry: channel tree, user map, text routing, broadcast
- vc_client full M1 C ABI: connect/TLS/handshake/auth/text/disconnect
- voicecat-admin CLI: account add/reset/del/list
- test_m1_integration: M1 exit criterion, verified green
Bug fixed: double-framing in ConnSession::send_envelope -- encode_envelope
was adding the [4-byte len] prefix, then TcpServerConn::send_frame added
a second one, causing the client to parse [len][proto] as protobuf (silent
failure). Fixed by serializing raw protobuf bytes in send_envelope and
letting send_frame apply the single length prefix.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-15 23:48:44 +02:00
|
|
|
# Tests use plain asserts + exit codes (no framework dep needed).
|
|
|
|
|
# Behavior tests — not just "it compiles" — are how milestones are judged (AGENTS.md).
|
scaffold: M0 skeleton + agent onboarding (build, architecture, progress)
Turn the design into a buildable, dependency-free M0 skeleton plus the
onboarding layer so a new agent can pick up instantly.
Build system:
- CMake + CMakePresets (dev = no deps; server-release = vcpkg) + vcpkg.json
- Skeleton builds with just a C++20 compiler; deps stay off until needed
- .gitattributes (LF), .gitignore, .clang-format
Core (libvoicecat):
- core/include/voicecat.h: full C ABI (the client/server contract), stubbed
- core/proto/voicecat.proto: control-plane wire format, matches docs/protocol.md
- src/{net,crypto,codec,protocol,session,audio,core}: subsystem stubs that
return VC_ERR_NOT_IMPLEMENTED, each pointing to its design doc
- server/ (voicecat-server) and tools/vccli/ link the core
- tests/: CTest smoke test asserting the C ABI contract (behavior, not just build)
- clients/{apple,windows}: M4 placeholders
Onboarding for agents:
- CLAUDE.md: hub — build/test commands, architecture at a glance, doc map, rules
- AGENTS.md: working method (behavior-driven; clean compile is the floor not the goal)
- PROGRESS.md: living tracker — M0 done, M1 task checklist, "where we left off"
Verified: cmake --preset dev && cmake --build --preset dev && ctest --preset dev → green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 21:09:09 +02:00
|
|
|
|
|
|
|
|
add_executable(test_smoke test_smoke.cpp)
|
|
|
|
|
target_link_libraries(test_smoke PRIVATE voicecat::voicecat)
|
|
|
|
|
target_compile_features(test_smoke PRIVATE cxx_std_20)
|
|
|
|
|
add_test(NAME smoke COMMAND test_smoke)
|
feat(M1): TCP/TLS control plane -- auth, channels, ephemeral text
Implements the full M1 milestone. Two clients authenticate over TLS 1.3
(guest + Argon2id password) and exchange channel + private text messages
through a real server. All five ctest --preset m1-dev tests pass in ~1 s.
Key components added:
- vcpkg baseline + m1-dev preset (protobuf/mbedTLS/libsodium/asio/sqlite3)
- FrameCodec feed+emit, encode/decode_envelope, protobuf codegen
- TcpServerConn with blocking TLS handshake thread + tls_read_loop
- TlsContext (mbedTLS 1.3, ECDSA-P256 self-signed cert, TOFU on client)
- WorkerPool (3 threads, used for Argon2id)
- Database: SQLite + libsodium Argon2id, account lifecycle, bootstrap admin
- ServerIdentityManager: Ed25519 key + cert generate/persist/fingerprint
- ConnSession state machine: WaitingHello -> WaitingAuth -> Authenticated
- SessionRegistry: channel tree, user map, text routing, broadcast
- vc_client full M1 C ABI: connect/TLS/handshake/auth/text/disconnect
- voicecat-admin CLI: account add/reset/del/list
- test_m1_integration: M1 exit criterion, verified green
Bug fixed: double-framing in ConnSession::send_envelope -- encode_envelope
was adding the [4-byte len] prefix, then TcpServerConn::send_frame added
a second one, causing the client to parse [len][proto] as protobuf (silent
failure). Fixed by serializing raw protobuf bytes in send_envelope and
letting send_frame apply the single length prefix.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-15 23:48:44 +02:00
|
|
|
|
build(cmake): clean up presets, add release/apple presets, cross-platform triplets
Rationalize the preset set to match the project's actual state (past M5):
- Rename dev->skeleton (no-deps stub smoke), m1-dev->dev (default dev preset)
- Drop m2-dev (cache-identical to m1-dev)
- Add release preset (optimized + tests on, symbols kept)
- Strip server-release binaries (-s linker flag)
- Add apple-dev/apple-ios/apple-ios-sim scaffolding presets for XCFramework
Add cmake/voicecat-toolchain.cmake wrapper that auto-resolves the vcpkg
triplet from the host platform (x64-mingw-static/x64-linux/arm64-osx) so
the main presets work on Windows/Linux/macOS without per-OS variants.
Update all docs (building.md, CLAUDE.md, README.md, AGENTS.md, deployment.md,
tech-stack.md, client READMEs) and stale preset-name references in code
comments. No C++ behavior changes — the core was already portable.
2026-06-18 03:16:01 +02:00
|
|
|
# frame_codec has no third-party deps; runs under both skeleton and dev.
|
feat(M1): TCP/TLS control plane -- auth, channels, ephemeral text
Implements the full M1 milestone. Two clients authenticate over TLS 1.3
(guest + Argon2id password) and exchange channel + private text messages
through a real server. All five ctest --preset m1-dev tests pass in ~1 s.
Key components added:
- vcpkg baseline + m1-dev preset (protobuf/mbedTLS/libsodium/asio/sqlite3)
- FrameCodec feed+emit, encode/decode_envelope, protobuf codegen
- TcpServerConn with blocking TLS handshake thread + tls_read_loop
- TlsContext (mbedTLS 1.3, ECDSA-P256 self-signed cert, TOFU on client)
- WorkerPool (3 threads, used for Argon2id)
- Database: SQLite + libsodium Argon2id, account lifecycle, bootstrap admin
- ServerIdentityManager: Ed25519 key + cert generate/persist/fingerprint
- ConnSession state machine: WaitingHello -> WaitingAuth -> Authenticated
- SessionRegistry: channel tree, user map, text routing, broadcast
- vc_client full M1 C ABI: connect/TLS/handshake/auth/text/disconnect
- voicecat-admin CLI: account add/reset/del/list
- test_m1_integration: M1 exit criterion, verified green
Bug fixed: double-framing in ConnSession::send_envelope -- encode_envelope
was adding the [4-byte len] prefix, then TcpServerConn::send_frame added
a second one, causing the client to parse [len][proto] as protobuf (silent
failure). Fixed by serializing raw protobuf bytes in send_envelope and
letting send_frame apply the single length prefix.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-15 23:48:44 +02:00
|
|
|
# Needs core/src on the include path to reach internal headers (protocol/, session/, etc.).
|
|
|
|
|
add_executable(test_frame_codec test_frame_codec.cpp)
|
|
|
|
|
target_link_libraries(test_frame_codec PRIVATE voicecat::voicecat)
|
|
|
|
|
target_compile_features(test_frame_codec PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_frame_codec PRIVATE ${CMAKE_SOURCE_DIR}/core/src)
|
|
|
|
|
add_test(NAME frame_codec COMMAND test_frame_codec)
|
|
|
|
|
|
|
|
|
|
if(VOICECAT_USE_VCPKG_DEPS)
|
|
|
|
|
set(VC_TEST_INTERNAL_INCLUDES
|
|
|
|
|
${CMAKE_SOURCE_DIR}/core/src
|
|
|
|
|
${CMAKE_SOURCE_DIR}/server/src
|
|
|
|
|
${CMAKE_BINARY_DIR}/core/generated) # protobuf-generated headers
|
|
|
|
|
|
|
|
|
|
add_executable(test_envelope test_envelope.cpp)
|
|
|
|
|
target_link_libraries(test_envelope PRIVATE voicecat::voicecat)
|
|
|
|
|
target_compile_features(test_envelope PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_envelope PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME envelope COMMAND test_envelope)
|
|
|
|
|
|
|
|
|
|
add_executable(test_tls_loopback test_tls_loopback.cpp)
|
|
|
|
|
target_link_libraries(test_tls_loopback PRIVATE voicecat::voicecat)
|
|
|
|
|
target_compile_features(test_tls_loopback PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_tls_loopback PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME tls_loopback COMMAND test_tls_loopback)
|
|
|
|
|
|
|
|
|
|
# Links voicecat::server (which pulls in voicecat::voicecat + all deps transitively).
|
|
|
|
|
add_executable(test_m1_integration test_m1_integration.cpp)
|
|
|
|
|
target_link_libraries(test_m1_integration PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_m1_integration PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_m1_integration PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME m1_integration COMMAND test_m1_integration)
|
|
|
|
|
set_tests_properties(m1_integration PROPERTIES TIMEOUT 60)
|
feat(M2): UDP voice/media plane -- SFU relay, Opus, AEAD, jitter buffer
Adds the full voice pipeline: 14-byte binary frame header, ChaCha20-Poly1305
AEAD keyed from the TLS exporter, libopus encode/decode with FEC/PLC/DTX,
an adaptive per-ssrc jitter buffer, a miniaudio capture/playback engine, an
APM passthrough stub, and the UdpBinding/StreamAnnounce signaling chain
wired through ConnSession/SessionRegistry into a new server-side SFU
(MediaRelay) that decrypts and re-encrypts frames per channel member.
Exit criterion verified: test_m2_voice — two headless clients relay 50
encrypted Opus frames through the server; ctest --preset m1-dev is 9/9
green. Also corrects protocol.md's UdpBinding diagram, which described the
UDP-side binding packet as AEAD-sealed when it is in fact a plaintext
bootstrap frame (separate from the TCP/TLS UdpBinding ack).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 01:31:14 +02:00
|
|
|
|
|
|
|
|
# ── M2 unit tests ──────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
add_executable(test_voice_frame test_voice_frame.cpp)
|
|
|
|
|
target_link_libraries(test_voice_frame PRIVATE voicecat::voicecat)
|
|
|
|
|
target_compile_features(test_voice_frame PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_voice_frame PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME voice_frame COMMAND test_voice_frame)
|
|
|
|
|
|
|
|
|
|
add_executable(test_media_aead test_media_aead.cpp)
|
|
|
|
|
target_link_libraries(test_media_aead PRIVATE voicecat::voicecat)
|
|
|
|
|
target_compile_features(test_media_aead PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_media_aead PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME media_aead COMMAND test_media_aead)
|
|
|
|
|
|
|
|
|
|
add_executable(test_opus_codec test_opus_codec.cpp)
|
|
|
|
|
target_link_libraries(test_opus_codec PRIVATE voicecat::voicecat)
|
|
|
|
|
target_compile_features(test_opus_codec PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_opus_codec PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME opus_codec COMMAND test_opus_codec)
|
|
|
|
|
|
fix(net): broadcast LEFT on disconnect, add keepalive/reaper, cap PLC hiss
Three reported bugs traced to one root cause plus two missing designed features:
1. Stale users + eternal PLC hiss (root cause): ConnSession::close() silently
erased dropped users without broadcasting UserEvent::LEFT, so peers never
learned the user left and their audio engines never called remove_stream —
Opus PLC synthesized comfort noise forever. Fix: broadcast_left() helper
+ close() broadcasts LEFT before erasing.
2. PLC cap (defense-in-depth): on_playback now caps pure PLC at ~2s, then
emits digital silence so a stale stream can never hiss forever even if
remove_stream is skipped. Resets automatically on fresh packets.
3. No timeout / no ping: client never sent Ping, server had no last_seen /
reaper, so half-open connections (NAT timeout, wifi loss, sleep) left
ghost users forever. Fix: client Ping every 15s with RTT measurement,
ConnSession::last_seen bumped on every inbound TCP/UDP frame, steady_timer
reaper sweeps every 15s and drops sessions older than 45s (configurable
via server::Config).
4. UDP KEEPALIVE: client sends plaintext kFrameKeepalive every 5s; server
bumps last_seen + echoes back. Keeps NAT bindings alive and lets media
activity defer the reaper independently of TCP.
5. Graceful client disconnect: vc_disconnect() sends Disconnect{code=0} via
a flag-based io-thread exit (no double-close race); server handles
client-sent Disconnect with immediate close() + LEFT broadcast.
3 new tests: disconnect_left, plc_cap, reaper_timeout. 21/21 ctest green.
Docs: protocol.md §6/§7, voice.md §6, architecture.md §5, PROGRESS.md.
2026-06-18 01:18:33 +02:00
|
|
|
# PLC cap: after ~2s of pure PLC (no real packets), the mixer emits silence instead of
|
|
|
|
|
# comfort noise — bounds the eternal-hiss failure mode (defense-in-depth for the
|
|
|
|
|
# disconnect/LEFT fix). White-box AudioEngine test, no server needed.
|
|
|
|
|
add_executable(test_plc_cap test_plc_cap.cpp)
|
|
|
|
|
target_link_libraries(test_plc_cap PRIVATE voicecat::voicecat)
|
|
|
|
|
target_compile_features(test_plc_cap PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_plc_cap PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME plc_cap COMMAND test_plc_cap)
|
|
|
|
|
|
2026-06-22 20:02:20 +02:00
|
|
|
# Jitter-buffer bounded depth: across many talkspurt/silence cycles with a compressed sender
|
|
|
|
|
# timeline + reordered stragglers, playout latency must stay bounded (no backward drift /
|
|
|
|
|
# ratchet). White-box AudioEngine test, no server needed.
|
|
|
|
|
add_executable(test_jitter_depth test_jitter_depth.cpp)
|
|
|
|
|
target_link_libraries(test_jitter_depth PRIVATE voicecat::voicecat)
|
|
|
|
|
target_compile_features(test_jitter_depth PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_jitter_depth PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME jitter_depth COMMAND test_jitter_depth)
|
|
|
|
|
|
2026-06-22 02:38:01 +02:00
|
|
|
# External playback (iOS VPIO): the mixer-timer thread drives decode+mix with NO hardware
|
|
|
|
|
# device and delivers the final mix to the mixed-output sink. White-box AudioEngine test.
|
|
|
|
|
add_executable(test_external_playback test_external_playback.cpp)
|
|
|
|
|
target_link_libraries(test_external_playback PRIVATE voicecat::voicecat)
|
|
|
|
|
target_compile_features(test_external_playback PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_external_playback PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME external_playback COMMAND test_external_playback)
|
|
|
|
|
|
feat(M2): UDP voice/media plane -- SFU relay, Opus, AEAD, jitter buffer
Adds the full voice pipeline: 14-byte binary frame header, ChaCha20-Poly1305
AEAD keyed from the TLS exporter, libopus encode/decode with FEC/PLC/DTX,
an adaptive per-ssrc jitter buffer, a miniaudio capture/playback engine, an
APM passthrough stub, and the UdpBinding/StreamAnnounce signaling chain
wired through ConnSession/SessionRegistry into a new server-side SFU
(MediaRelay) that decrypts and re-encrypts frames per channel member.
Exit criterion verified: test_m2_voice — two headless clients relay 50
encrypted Opus frames through the server; ctest --preset m1-dev is 9/9
green. Also corrects protocol.md's UdpBinding diagram, which described the
UDP-side binding packet as AEAD-sealed when it is in fact a plaintext
bootstrap frame (separate from the TCP/TLS UdpBinding ack).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 01:31:14 +02:00
|
|
|
# M2 exit criterion: two headless clients relay encrypted Opus frames via the SFU.
|
|
|
|
|
add_executable(test_m2_voice test_m2_voice.cpp)
|
|
|
|
|
target_link_libraries(test_m2_voice PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_m2_voice PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_m2_voice PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME m2_voice COMMAND test_m2_voice)
|
|
|
|
|
set_tests_properties(m2_voice PROPERTIES TIMEOUT 120)
|
2026-06-16 02:12:50 +02:00
|
|
|
|
|
|
|
|
# Same exit criterion, but through the real C ABI (vc_client), not raw sockets —
|
|
|
|
|
# proves stream_start/stop/UDP-binding in core/src/core/client.cpp actually work.
|
|
|
|
|
add_executable(test_voice_client_abi test_voice_client_abi.cpp)
|
|
|
|
|
target_link_libraries(test_voice_client_abi PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_voice_client_abi PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_voice_client_abi PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME voice_client_abi COMMAND test_voice_client_abi)
|
|
|
|
|
set_tests_properties(voice_client_abi PROPERTIES TIMEOUT 60)
|
feat(M3): multi-stream & per-channel tuning
Implements docs/roadmap.md M3: multiple concurrent streams per user (MIC +
SCREEN_AUDIO + AUX_DEVICE), independent per-stream receiver gain/mute/noise-
reduction, talk indicators, and enforced per-channel Opus configurability
(mono/stereo, bitrate, frame size, FEC/DTX, application).
Bugs fixed along the way (found while implementing, not pre-existing scope):
- Server hard-coded stream_id=1 for every announce, so a second stream from
the same user silently overwrote the first in SessionRegistry::set_user_stream.
Now a per-session counter (ConnSession::next_stream_id_); handle_stream_stop
validates against announced_stream_ids_ before clearing.
- Client dropped mode/dtx/complexity/application from effective_audio even for
the single M2 stream -- only sample_rate/bitrate_bps/frame_ms/fec were ever
applied to OpusParams. Fixed on both the send (handle_stream_announce_result)
and receive (sync_remote_streams) paths via a shared
opus_params_from_audio_config() helper.
- OpusEncoder always used OPUS_APPLICATION_VOIP; added OpusParams::application
and wired it through.
- on_playback's per-stream decode passed the wrong frame_size to opus_decode
(total samples instead of samples-per-channel), which would have overflowed
the decode buffer for any stereo stream.
- teardown_voice() raced when called concurrently from run_io()'s own cleanup
and from disconnect() on a different thread -- both could see
udp_thread_/talk_timer_thread_ as joinable() at once and race to join() the
same std::thread (intermittent std::system_error under ctest). Fixed with a
teardown_mu_ guard instead of carrying the flake forward.
New:
- Per-channel AudioConfig: SessionRegistry now seeds Lobby (mono/24kbps/VOIP/
FEC+DTX) and a new "Music Room" channel (stereo/128kbps/AUDIO/no DTX);
handle_stream_announce enforces the channel's config, clamping (not
overriding) bitrate_bps to its ceiling.
- core/src/core/client.h/.cpp: local-stream state is now a
std::unordered_map<int, LocalStream> keyed by vc_stream_kind, with
request_id-correlated announce/result handling (request_id already
round-tripped on the wire; just wasn't read before). on_capture_frame is
kind-aware and upmixes mono capture to stereo when a stream's config calls
for it. set_self_mute's mic_muted now only gates the MIC kind. NS is wired
through set_remote_stream. New run_talk_timer() thread emits
VC_EVENT_TALK_STATE from both remote and local edge detection.
- core/src/audio/audio_engine.h/.cpp: kind-keyed injection taps
(inject_capture), stereo-to-mono downmix at the decode/mix boundary,
RemoteStream gains recv_ns (lazy ApmProcessor) + noise_reduction_enabled
and last_voice_ms/talking; new set_stream_noise_reduction() and
poll_talk_transitions().
- core/src/session/session.h/.cpp: Stream now carries the full AudioConfig,
not just sample_rate/frame_ms.
- New additive C ABI (core/include/voicecat.h): vc_audio_config +
vc_get_stream_audio_config (effective Opus config for any stream you own or
a peer's); vc_test_inject_capture (test-only synthetic PCM injection,
clearly marked, mirrors AudioEngine::inject_capture).
- tests/test_m3_multistream.cpp: the M3 exit criterion through the real ABI
(mirrors test_voice_client_abi.cpp's approach, not raw sockets) -- two
concurrent local streams, independent gain/mute/NS control, per-channel
config divergence via vc_get_stream_audio_config, talk indicators.
Explicitly out of scope for this pass (tracked in PROGRESS.md, not silently
dropped): VAD/PTT input gate + device enumeration; real WASAPI loopback
capture for SCREEN_AUDIO (synthetic injection only); true stereo playback
output (AudioEngine's mixer/output device stays mono -- Opus itself is fully
stereo-correct on the wire).
ctest --test-dir build/m1-dev: 11/11 green, verified across 3 consecutive
full-suite runs plus 8 standalone runs of the new test.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 14:12:37 +02:00
|
|
|
|
|
|
|
|
# M3 exit criterion: multi-stream (mic + desktop audio), independent per-stream
|
|
|
|
|
# gain/mute/NS, per-channel Opus configurability, talk indicators -- all through the
|
|
|
|
|
# real C ABI (vc_client), not raw sockets.
|
|
|
|
|
add_executable(test_m3_multistream test_m3_multistream.cpp)
|
|
|
|
|
target_link_libraries(test_m3_multistream PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_m3_multistream PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_m3_multistream PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME m3_multistream COMMAND test_m3_multistream)
|
|
|
|
|
set_tests_properties(m3_multistream PROPERTIES TIMEOUT 60)
|
feat: device enumeration, VAD/PTT input gate, stereo playback, WASAPI loopback
Closes the three items PROGRESS.md's M3 section explicitly carried forward as
out of scope:
- Device enumeration (vc_list_devices) + input device selection
(vc_set_input_device), backed by AudioEngine::enumerate_devices() via
miniaudio's ma_context_get_devices. Device ids are opaque hex-encoded
ma_device_id strings.
- VAD/PTT send-side input gate (vc_set_input_mode, vc_set_push_to_talk).
webrtc-audio-processing (the originally-planned APM) has no working
Windows/MSVC build upstream (GCC-only Meson, unfinished MinGW support, hard
abseil-cpp dependency), so VAD is a new lightweight, dependency-free
energy/RMS processor (EnergyVadProcessor) behind the existing ApmProcessor
interface. Gating is MIC-only; SCREEN_AUDIO/AUX_DEVICE always bypass it.
- True stereo playback: AudioEngine's mixer and output device now carry
stereo end-to-end (mono streams upmix L=R) instead of downmixing decoded
stereo streams to mono before mixing.
- Real WASAPI loopback capture for SCREEN_AUDIO (Windows-only, via
miniaudio's loopback device type), replacing test-only injection as the
production capture path.
Also: vccli gains --list-devices, --input-device, --input-mode, and
--share-screen-audio flags, plus a stdin command loop (ptt on/off, mode
vad/ptt) for manual verification. New test_vad_ptt_devices.cpp covers all
four items (ABI-level + a white-box AudioEngine stereo-mix check).
Docs updated to match: voice.md, roadmap.md (decision-log entry superseding
the original webrtc-audio-processing choice), tech-stack.md, README.md,
architecture.md, CLAUDE.md, PROGRESS.md.
Still explicitly out of scope, documented not silently dropped: real
webrtc-audio-processing/AEC (no AEC/NS/AGC exists at all yet), macOS/iOS
SCREEN_AUDIO capture, process-specific loopback, and a pre-existing
RT-thread rule violation in the capture path that predates this work.
Verified: ctest 12/12 green across 3 consecutive full-suite runs (both dev
and m1-dev presets build clean); test_vad_ptt_devices passed 5 consecutive
standalone runs; manually verified live (vccli --list-devices against real
hardware, vccli --voice --input-mode vad streaming without incident).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 16:11:52 +02:00
|
|
|
|
|
|
|
|
# Post-M3 follow-up: device enumeration, VAD/PTT input gate, true stereo playback mixing —
|
|
|
|
|
# the items PROGRESS.md's M3 section explicitly carried forward as out of scope.
|
|
|
|
|
add_executable(test_vad_ptt_devices test_vad_ptt_devices.cpp)
|
|
|
|
|
target_link_libraries(test_vad_ptt_devices PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_vad_ptt_devices PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_vad_ptt_devices PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME vad_ptt_devices COMMAND test_vad_ptt_devices)
|
|
|
|
|
set_tests_properties(vad_ptt_devices PROPERTIES TIMEOUT 60)
|
feat(M4): Windows WinForms client, TOFU identity pinning, VAD threshold + always-on mode
Core ABI extensions (voicecat.h):
- vc_list_channels / vc_list_users / vc_list_user_streams — pull-based snapshot getters
for the channel-tree and user-list UI; session_model_mu_ guards cross-thread reads
- VC_EVENT_JOIN_RESULT / vc_join_channel — channel join with optional password
- VC_EVENT_SERVER_IDENTITY + vc_confirm_server_identity — TOFU gate that blocks io_thread_
until the UI approves or rejects; pins TLS leaf-cert SHA-256 (not declared Ed25519)
- vc_get_server_identity_display — Ed25519 fingerprint for human-readable display only
- VC_INPUT_ALWAYS_ON = 2 in vc_input_mode — transmit unconditionally, no VAD gate
- vc_set_vad_threshold — live RMS threshold update (0.0–1.0); EnergyVadProcessor stores
it atomically so the audio RT path reads without a lock
C++ implementation:
- SessionModel::apply_snapshot / apply_channel_event fixed to populate parent_id,
password_protected, and max_users (were permanently zeroed)
- TlsContext::peer_cert_fingerprint — SHA-256 of peer leaf cert DER via mbedTLS
- TofuStore split into peek (read-only) + pin (write) so first-connect only persists
after user approval; tofu_store_path in vc_config for per-user pin file location
- TcpAcceptor uses dual-stack IPv6+IPv4 fallback (fixes localhost → ::1 on Windows)
- windows-client CMake preset: Release shared DLL, static MinGW runtime, no tools/tests
- New C++ tests: test_channel_user_list_abi, test_tofu_flow (14/14 green)
Windows client (clients/windows/ — .NET 10 WinForms):
- VoiceCat.Interop: LibraryImport P/Invoke surface, UnmanagedCallersOnly callbacks,
Channel<VoiceCatEvent> event delivery drained by 30ms WinForms Timer
- VoiceCat.App: ConnectDialog (saved servers, DPAPI password storage), ServerIdentity-
Dialog (TOFU first-connect / mismatch warning), MainForm (channel TreeView, user
ListBox, RichTextBox chat, voice controls, device pickers, VAD/PTT/always-on mode,
per-user gain/mute/NR tuning, VAD sensitivity TrackBar, level meter ProgressBar)
- PttKeyCaptureDialog — focus-scoped PTT key capture (documented limitation)
- PerUserTuningDialog — real-time gain/mute/NR applied to all of a user's streams
- Accessibility: explicit AccessibleName/Description on every control, & mnemonics,
Activity log ListBox as durable screen-reader record, AutomationNotification for
curated live announcements
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-17 00:35:16 +02:00
|
|
|
|
|
|
|
|
# M4: channel/user/stream snapshot getters (vc_list_channels/vc_list_users/
|
|
|
|
|
# vc_list_user_streams) — through the real C ABI against a real in-process server.
|
|
|
|
|
add_executable(test_channel_user_list_abi test_channel_user_list_abi.cpp)
|
|
|
|
|
target_link_libraries(test_channel_user_list_abi PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_channel_user_list_abi PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_channel_user_list_abi PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME channel_user_list_abi COMMAND test_channel_user_list_abi)
|
|
|
|
|
set_tests_properties(channel_user_list_abi PROPERTIES TIMEOUT 60)
|
|
|
|
|
|
|
|
|
|
# M4: TOFU server-identity gate (VC_EVENT_SERVER_IDENTITY / vc_confirm_server_identity /
|
|
|
|
|
# vc_get_server_identity_display) — real TLS handshakes against real in-process servers.
|
|
|
|
|
add_executable(test_tofu_flow test_tofu_flow.cpp)
|
|
|
|
|
target_link_libraries(test_tofu_flow PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_tofu_flow PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_tofu_flow PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME tofu_flow COMMAND test_tofu_flow)
|
|
|
|
|
set_tests_properties(tofu_flow PROPERTIES TIMEOUT 90)
|
M5: moderation, permissions, channel CRUD, in-app account management
- Server-side moderation & permissions (kick/ban/move/server-mute, channel CRUD).
- Database schema v2: channels, bans; BLAKE2b channel passwords, Argon2id accounts.
- C ABI additions and client-side handling (vc_kick_user, vc_ban_user, vc_set_permission, vc_set_server_mute, vc_move_user, vc_create/edit/delete_channel, vc_create/reset/delete/list_account).
- vccli flags for all M5 operations plus --username/--password auth.
- Four new tests covering permissions, kick/ban/move/mute, admin accounts, channel CRUD.
- Docs: protocol.md envelope updates, security.md channel-password hashing, PROGRESS.md.
2026-06-17 15:08:05 +02:00
|
|
|
|
|
|
|
|
# M5 Phase 1: permission enforcement + SetPermissionRequest + channel create.
|
|
|
|
|
add_executable(test_m5_permissions test_m5_permissions.cpp)
|
|
|
|
|
target_link_libraries(test_m5_permissions PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_m5_permissions PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_m5_permissions PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME m5_permissions COMMAND test_m5_permissions)
|
|
|
|
|
set_tests_properties(m5_permissions PROPERTIES TIMEOUT 60)
|
|
|
|
|
|
|
|
|
|
# M5 Phase 2: kick/ban/move/server-mute.
|
|
|
|
|
add_executable(test_m5_kick_ban_move_mute test_m5_kick_ban_move_mute.cpp)
|
|
|
|
|
target_link_libraries(test_m5_kick_ban_move_mute PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_m5_kick_ban_move_mute PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_m5_kick_ban_move_mute PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME m5_kick_ban_move_mute COMMAND test_m5_kick_ban_move_mute)
|
|
|
|
|
set_tests_properties(m5_kick_ban_move_mute PROPERTIES TIMEOUT 90)
|
|
|
|
|
|
|
|
|
|
# M5 Phase 3: in-app admin account management.
|
|
|
|
|
add_executable(test_m5_admin_accounts test_m5_admin_accounts.cpp)
|
|
|
|
|
target_link_libraries(test_m5_admin_accounts PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_m5_admin_accounts PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_m5_admin_accounts PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME m5_admin_accounts COMMAND test_m5_admin_accounts)
|
|
|
|
|
set_tests_properties(m5_admin_accounts PROPERTIES TIMEOUT 90)
|
|
|
|
|
|
|
|
|
|
# M5 Phase 4: channel CRUD & password enforcement.
|
|
|
|
|
add_executable(test_m5_channel_crud test_m5_channel_crud.cpp)
|
|
|
|
|
target_link_libraries(test_m5_channel_crud PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_m5_channel_crud PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_m5_channel_crud PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME m5_channel_crud COMMAND test_m5_channel_crud)
|
|
|
|
|
set_tests_properties(m5_channel_crud PROPERTIES TIMEOUT 90)
|
fix(net): broadcast LEFT on disconnect, add keepalive/reaper, cap PLC hiss
Three reported bugs traced to one root cause plus two missing designed features:
1. Stale users + eternal PLC hiss (root cause): ConnSession::close() silently
erased dropped users without broadcasting UserEvent::LEFT, so peers never
learned the user left and their audio engines never called remove_stream —
Opus PLC synthesized comfort noise forever. Fix: broadcast_left() helper
+ close() broadcasts LEFT before erasing.
2. PLC cap (defense-in-depth): on_playback now caps pure PLC at ~2s, then
emits digital silence so a stale stream can never hiss forever even if
remove_stream is skipped. Resets automatically on fresh packets.
3. No timeout / no ping: client never sent Ping, server had no last_seen /
reaper, so half-open connections (NAT timeout, wifi loss, sleep) left
ghost users forever. Fix: client Ping every 15s with RTT measurement,
ConnSession::last_seen bumped on every inbound TCP/UDP frame, steady_timer
reaper sweeps every 15s and drops sessions older than 45s (configurable
via server::Config).
4. UDP KEEPALIVE: client sends plaintext kFrameKeepalive every 5s; server
bumps last_seen + echoes back. Keeps NAT bindings alive and lets media
activity defer the reaper independently of TCP.
5. Graceful client disconnect: vc_disconnect() sends Disconnect{code=0} via
a flag-based io-thread exit (no double-close race); server handles
client-sent Disconnect with immediate close() + LEFT broadcast.
3 new tests: disconnect_left, plc_cap, reaper_timeout. 21/21 ctest green.
Docs: protocol.md §6/§7, voice.md §6, architecture.md §5, PROGRESS.md.
2026-06-18 01:18:33 +02:00
|
|
|
|
|
|
|
|
# Disconnect/timeout: server broadcasts UserEvent::LEFT on TCP drop (no more ghost
|
|
|
|
|
# users or eternal PLC hiss on peers). Also covers the keepalive/reaper paths added
|
|
|
|
|
# alongside the LEFT-broadcast fix.
|
|
|
|
|
add_executable(test_disconnect_left test_disconnect_left.cpp)
|
|
|
|
|
target_link_libraries(test_disconnect_left PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_disconnect_left PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_disconnect_left PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME disconnect_left COMMAND test_disconnect_left)
|
|
|
|
|
set_tests_properties(disconnect_left PROPERTIES TIMEOUT 90)
|
|
|
|
|
|
|
|
|
|
# Reaper: half-open connections (no TCP EOF) are dropped after the configurable timeout,
|
|
|
|
|
# peers get UserEvent::LEFT, the stale client gets disconnected. Uses a 2s timeout for
|
|
|
|
|
# fast test turnaround (production default is 45s).
|
|
|
|
|
add_executable(test_reaper_timeout test_reaper_timeout.cpp)
|
|
|
|
|
target_link_libraries(test_reaper_timeout PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_reaper_timeout PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_reaper_timeout PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME reaper_timeout COMMAND test_reaper_timeout)
|
|
|
|
|
set_tests_properties(reaper_timeout PROPERTIES TIMEOUT 30)
|
2026-06-20 13:40:47 +02:00
|
|
|
|
|
|
|
|
# DRED toggle: per-channel dred flag round-trips through protocol; encoder initialises
|
|
|
|
|
# with DRED; PCM injection through DRED-enabled encode path runs without crash.
|
|
|
|
|
add_executable(test_dred_toggle test_dred_toggle.cpp)
|
|
|
|
|
target_link_libraries(test_dred_toggle PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_dred_toggle PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_dred_toggle PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME dred_toggle COMMAND test_dred_toggle)
|
|
|
|
|
set_tests_properties(dred_toggle PROPERTIES TIMEOUT 60)
|
feat: external PCM feed/tap API (vc_stream_feed_pcm + vc_set_pcm_sink)
Promotes vc_test_inject_capture (mono-only, TEST-ONLY) to a public,
stereo-capable production API and adds a symmetric PCM tap on the
receive side. Enables ReplayKit (iOS), ScreenCaptureKit (macOS), bots,
soundboards, and custom clients — all without a hardware audio device.
Core C++:
- voicecat.h: new vc_stream_feed_pcm, vc_pcm_sink_cb typedef,
vc_set_pcm_sink; vc_test_inject_capture kept as deprecated alias
- audio_engine: stereo-aware inject_capture (channels param + ring
reset on channel-count change); atomic pcm_sink_ fired per decoded
frame in on_playback; RemoteStream carries user_id/stream_id for
RT-safe sink metadata; init_recv_stream takes user_id+stream_id
- client.cpp: stream_feed_pcm / set_pcm_sink implementations;
sync_remote_streams passes user_id/stream_id to init_recv_stream
- voicecat.cpp: trampolines + channels=1/2 validation
Tests: test_external_pcm (headless, 3 sub-tests: mono round-trip,
stereo feed L≠R, sink metadata+disable). ctest 23/23.
Swift: feedPcm / setPcmSink in VoiceCatClient.swift + 4 XCTest
smoke tests (ExternalPcmTests.swift).
C#: StreamFeedPcm / SetPcmSink in VoiceCatClient.cs + NativeMethods.cs
(vc_stream_feed_pcm unsafe P/Invoke, VcPcmSinkCallback delegate,
vc_set_pcm_sink via nint) + 4 xUnit smoke tests (ExternalPcmTests.cs).
Docs: architecture.md §4 new subsection, voice.md §9 updated
(macOS/iOS now reference vc_stream_feed_pcm), protocol.md §8 explicit
no-protocol-change note, roadmap.md M5 entry.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 17:52:09 +02:00
|
|
|
|
|
|
|
|
# External PCM feed/tap API:
|
|
|
|
|
# test_feed_pcm_round_trip — vc_stream_feed_pcm (mono), verified via pcm_sink.
|
|
|
|
|
# test_feed_pcm_stereo — vc_stream_feed_pcm (stereo, Music Room), L != R assertion.
|
|
|
|
|
# test_pcm_sink — vc_set_pcm_sink metadata (user_id / stream_id / sr) + disable.
|
|
|
|
|
add_executable(test_external_pcm test_external_pcm.cpp)
|
|
|
|
|
target_link_libraries(test_external_pcm PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_external_pcm PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_external_pcm PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME external_pcm COMMAND test_external_pcm)
|
|
|
|
|
set_tests_properties(external_pcm PROPERTIES TIMEOUT 90)
|
2026-06-22 16:45:02 +02:00
|
|
|
|
|
|
|
|
# Non-20ms channel frame_ms: the fixed 48k/20ms engine clock is reframed to the channel's
|
|
|
|
|
# Opus window before encoding. 40ms (accumulate) and 10ms (split) feed->sink round trips.
|
|
|
|
|
add_executable(test_frame_ms_reframe test_frame_ms_reframe.cpp)
|
|
|
|
|
target_link_libraries(test_frame_ms_reframe PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_frame_ms_reframe PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_frame_ms_reframe PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME frame_ms_reframe COMMAND test_frame_ms_reframe)
|
|
|
|
|
set_tests_properties(frame_ms_reframe PROPERTIES TIMEOUT 90)
|
2026-06-22 16:56:49 +02:00
|
|
|
|
|
|
|
|
# Per-channel sample_rate as an Opus bandwidth cap (OPUS_SET_MAX_BANDWIDTH): a 7 kHz tone is
|
|
|
|
|
# attenuated on an 8 kHz (narrowband) channel vs a 48 kHz (full-band) channel.
|
|
|
|
|
add_executable(test_channel_samplerate test_channel_samplerate.cpp)
|
|
|
|
|
target_link_libraries(test_channel_samplerate PRIVATE voicecat::server)
|
|
|
|
|
target_compile_features(test_channel_samplerate PRIVATE cxx_std_20)
|
|
|
|
|
target_include_directories(test_channel_samplerate PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
|
|
|
add_test(NAME channel_samplerate COMMAND test_channel_samplerate)
|
|
|
|
|
set_tests_properties(channel_samplerate PROPERTIES TIMEOUT 90)
|
feat(M1): TCP/TLS control plane -- auth, channels, ephemeral text
Implements the full M1 milestone. Two clients authenticate over TLS 1.3
(guest + Argon2id password) and exchange channel + private text messages
through a real server. All five ctest --preset m1-dev tests pass in ~1 s.
Key components added:
- vcpkg baseline + m1-dev preset (protobuf/mbedTLS/libsodium/asio/sqlite3)
- FrameCodec feed+emit, encode/decode_envelope, protobuf codegen
- TcpServerConn with blocking TLS handshake thread + tls_read_loop
- TlsContext (mbedTLS 1.3, ECDSA-P256 self-signed cert, TOFU on client)
- WorkerPool (3 threads, used for Argon2id)
- Database: SQLite + libsodium Argon2id, account lifecycle, bootstrap admin
- ServerIdentityManager: Ed25519 key + cert generate/persist/fingerprint
- ConnSession state machine: WaitingHello -> WaitingAuth -> Authenticated
- SessionRegistry: channel tree, user map, text routing, broadcast
- vc_client full M1 C ABI: connect/TLS/handshake/auth/text/disconnect
- voicecat-admin CLI: account add/reset/del/list
- test_m1_integration: M1 exit criterion, verified green
Bug fixed: double-framing in ConnSession::send_envelope -- encode_envelope
was adding the [4-byte len] prefix, then TcpServerConn::send_frame added
a second one, causing the client to parse [len][proto] as protobuf (silent
failure). Fixed by serializing raw protobuf bytes in send_envelope and
letting send_frame apply the single length prefix.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-15 23:48:44 +02:00
|
|
|
endif()
|