Commit Graph
5 Commits
Author SHA1 Message Date
isaacandClaude Fable 5.1 120e384bbf v2: one-round negotiation and a DTLS-role backstop in 11.0.0
Two defects shared by every InstanceV2ReferenceImpl build, found in the
2026-10-11 Android log sample (getlogstgcalls/analysis/FINDINGS-android.md).

- Every call took two offer/answer rounds: both sides pre-create their audio
  transceiver with AddTransceiver, which FindAvailableTransceiverToReceive never
  associates with the caller's m=0, so the callee answered recvonly and
  re-offered its audio as a new m-section. network_reference_use_addtrack is
  now default on and covers the camera (addSendTransceiver): 2
  SetLocalDescription per call instead of 4, the callee's answer sendrecv, no
  glare window on every call. SetCodecPreferences is skipped on a transceiver
  AddTrack reused (it already has a mid; the peer negotiated its codec list).
- A rejected answer ("order of m-lines", the offer was replaced in flight) left
  the caller without a DTLS role, and it then answered the callee's colliding
  offer as a second DTLS client: handshake failure on a connected ICE path,
  every later SDP "Failed to set SSL role", no recovery (43 of 200 Android
  calls). sendLocalDescription() remembers that the peer answered setup:active
  and, when answering an offer in that state, sets passive on the created
  answer's transport descriptions and applies it from the CreateAnswer
  callback on the signaling thread, so nothing can land in between.

tools/cli: --video-late-caller-ms / --video-late-callee-ms attach one side's
camera N ms after start; network_reference_immediate_capture_renegotiation
(read only under TGCALLS_ALLOW_TEST_KNOBS, a CLI-only define) restores the
pre-2026-09-17 immediate offer so run-negotiation-tests.sh reproduces the
Android chain in-process. All four scenarios failed before and pass after;
mixed old/new pairings, mid-call cameras, mtproto and 30% signaling loss
checked.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-13 14:47:15 +04:00
isaac afb8f1c699 cli: add --custom-params/--custom-params2
The test CLI could only ever set wasm_core_path in customParameters, so no
engine custom parameter could be exercised. Merges an arbitrary JSON object
from the new flags with the synthesised wasm_core_path entry; with neither
flag passed the value stays empty exactly as before.
2026-08-20 14:10:48 +02:00
isaacandClaude Opus 5 cab9a2508a v2wasm: pluggable call core behind a C ABI — native or WASM module
Ports InstanceV2ReferenceImpl's control logic out into a self-contained
"call core" that runs either natively or as a runtime-loaded WASM module
(WAMR), so call behavior can change without shipping a new binary.

- CallCoreABI.h: frozen ABI v1, shaped as a PeerConnection projection —
  SDP munge point, transceiver/parameter/ICE-restart commands, observer
  events, curated rich stats (pc_get_stats).
- CallCoreHost: fixed host harness executing core commands against the
  real PeerConnection. NativeCoreBackend / WamrCoreBackend select the
  core at runtime (--wasm-core); per-module createModuleCore factory seam.
- ReferenceCallCore: stock-parity control logic behind the ABI.
  VariantCallCore: demo core showing behavior changes (fmtp munge,
  adaptive bitrate cap, periodic ICE restart), shipped as wasm only.
- InstanceV2PumpImpl: pump instance registered as 10.0.0-pump/11.0.0-pump.
- Protocol substrate: SignalingFraming ports EncryptedConnection
  reliability (V1) and gzip framing (V2) into the core, so the host
  boundary is raw signaling packets (seal/open only); N labeled data
  channels with binary payloads; audio-processing and PeerConnection
  config knobs.
- Compression is a host service (env.host_deflate/env.host_inflate)
  rather than vendored miniz, keeping the wasm modules small and making
  compressed bytes match stock exactly.
- tools/cli: --log-file. tools/parity: P1/P2 wire-parity scripts.

Squashed from the tgcalls-wasm-core-sketch branch (31 commits).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-27 01:28:00 +08:00
isaacandClaude Opus 4.7 3160270a35 ReferenceImpl: real audio levels via per-receiver PCM sink
Replace GroupInstanceReferenceImpl's hardcoded 0.1 synthetic
audio level (reported for every known SSRC, regardless of whether
the participant was actually producing audio) with a real
peak-amplitude reading per remote receiver.

Implementation:
- New GRAudioLevelSink (webrtc::AudioTrackSinkInterface)
  attached to each remote audio track after onRenegotiationComplete
  via the new wireRemoteAudioLevelSinks(). Tracks per-window peak
  amplitude in PCM, normalized to RFC 6464's "0 dBov = full-scale
  sine wave" reference (peak / (32768/sqrt(2))) so the value is
  comparable to CustomImpl's pow(10, -dbov/20) reading.
- pollAudioLevels() now reads consumeLevel() from each sink and
  skips entries whose sink has produced no samples since the last
  poll, eliminating phantom level entries for known-but-silent
  SSRCs.
- buildRemoteAnswer() now includes the remote SSRC on each
  recvonly audio m-line. Without a signaled SSRC the
  AudioRtpReceiver calls SetDefaultRawAudioSink and only one of N
  transceivers' RemoteAudioSource ever receives PCM (the rest stay
  silent and our sinks never fire). MID is excluded from audio
  m-lines, so BUNDLE demuxes by SSRC.
- Result for a 3000-amplitude sine through Opus: ~0.126, matching
  CustomImpl's reading.

Test infrastructure (CLI):
- New --mute-participants <ids> flag (comma-separated participant
  IDs) keeps a participant muted after join.
- ParticipantState gains a per-source-SSRC max-level map.
- validateGroupState enforces: no peer may report a muted
  participant's SSRC at level >= 0.05. The relaxed audio-received
  check applies only to unmuted participants.

This is a pre-requisite for the upcoming SSRC-discovery work
(per-receiver level sinks must already exist before
onRenegotiationComplete starts wiring them up for tap-discovered
SSRCs).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 10:44:21 +02:00
isaacandClaude Opus 4.7 aaa583f1a9 feat: add testbench (CLI tool, Go SFU, Dockerfile, docs)
Brings the testbench source into the submodule:
- tools/cli/ — C++ CLI test tool (P2P, reflector, group, group-churn modes)
- tools/go_sfu/ — Go/Pion SFU library, c-archive linked into tgcalls_cli
- Dockerfile — multi-stage Linux container build
- CLAUDE.md (top-level), tools/cli/CLAUDE.md, tools/go_sfu/CLAUDE.md — docs

Bazel build glue (.bazelrc, MODULE.bazel, third-party BUILD edits, tgcalls_core
target) remains in the outer repo since the dependency stack lives there;
labels and paths in this repo reference the outer-repo workspace root.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 19:00:55 +02:00