Files
tgcalls/tools/cli/group_mode.h
isaacandClaude Fable 5.1 f359144db7 group: ReferenceImpl never lets WebRTC create unsignaled receive streams
Two production defects with one cause: a packet the network thread has
already handed to the worker when the worker tears down a receive
stream is received as an unknown SSRC, and WebRTC creates a default
("unsignaled") receive stream for it on a channel whose remote content
never changes again. That stream is never reset and keeps the SSRC's
binding in the Call's RtpDemuxer, so the m-line later negotiated for
the SSRC logs "Sink could not be added" and never receives a packet.

Video (device log 2026-09-18): after the app dropped all video
endpoints and requested them again on the same PeerConnection, one tile
stayed frozen while every decoded frame logged
"VideoReceiveStreamInterface not connected to a VideoSink". The factory
now gets its own FieldTrialsView (GRFieldTrials) that enables
WebRTC-Video-DiscardPacketsWithUnknownSsrc and resolves everything else
through tgcalls' shared FieldTrialBasedConfig; before, the engine
inherited the trial only if a CustomImpl call had run earlier in the
process.

Audio (found in the CLI while reproducing the above): the same race at
the first discovery renegotiation recreated an unsignaled stream on the
mid-0 catch-all right after WebRTC reset it. The participant stayed
audible through that stream, but the level sink on the dedicated
receiver never fired, so peers never saw them as speaking (2 of 6 level
sinks dead in a 3-participant run). The outgoing audio transceiver is
now sendonly (answered recvonly), the GRAudioFrameTransformer catch-all
is gone, discovery goes only through the un-demuxable-packet tap, and
the PeerConnection opts into the new vendored-webrtc seam
RTCConfiguration::disable_payload_type_demuxing. The seam is
load-bearing: without it the lone recvonly audio m-line becomes the
payload-type catch-all and a late unmuter is swallowed there
(--unmute-after scored 0/2). First remote audio now arrives ~280 ms
after the first packet (debounce plus one offer/answer), as with
CustomImpl.

CLI: --video-rerequest drops and re-requests every video endpoint five
times under a 150 ms SFU downlink delay and requires every sink to
receive frames past the count taken just before the re-request
(reproduces the frozen tile with --reference-participants 6: 1/30
stalled on the unfixed engine, both runs). Every group run now also
prints "Audio levels heard: X/Y pairs" (every peer must report a real
level for every unmuted sender) and "Unsignaled audio: N stream(s)
(must be 0)" (engine log scanned for the stream WebRTC creates on its
own; 6 for 3 reference participants before). Full sweep green: audio
3 and 6 reference participants, late unmute (reference and mixed),
mixed e2e with video, reference e2e, custom-only, early video request,
capture feeds, 6-participant re-request, group-churn, bandwidth
step-down scenarios.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

(cherry picked from commit a029775032)

Already in dev/android (via 45fc400/120e384), left as is:
  CLAUDE.md
  tools/cli/CLAUDE.md
  tools/cli/main.cpp

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:49:51 +04:00

9 lines
480 B
C++

#pragma once
#include <set>
#include <string>
#include "group_participant.h"
int runGroupMode(int customParticipants, int referenceParticipants, int duration, bool quiet, bool video, const std::string& networkScenario = "", const std::set<int>& mutedParticipants = {}, bool earlyVideoRequest = false, bool videoSinkChurn = false, bool e2e = false, VideoFeed videoFeed = VideoFeed::Source, bool requestOwnVideo = false, int unmuteAfterSeconds = 0, bool videoRerequest = false);