Telegram-iOS/submodules/TgVoipWebrtc/BUILD
Isaac 5962a563e4 feat: tgcalls CLI test tool with group SFU, video, and adaptation
Squashed buildout of the tgcalls testbench:

- CLI test tool with --mode p2p/reflector/group/group-churn,
  cross-version interop (--version, --version2), and quiet/summary output
- Linux toolchain + Docker multi-stage build, AWS Fargate mass test harness,
  local parallel mass test harness with signaling loss simulation
- SCTP writable gate, retransmission timer tuning, role-based handshake
- InstanceV2CompatImpl (PeerConnection backend with V2Impl signaling) and
  SignalingTranslator for v14.0.0 interop
- In-process Go/Pion SFU (ICE+DTLS+SRTP+SCTP per participant) with audio
  RTP forwarding, ActiveAudio/VideoSsrcs data channel broadcast, RTCP
  feedback path, and CGo c-archive integration
- GroupInstanceReferenceImpl (PeerConnection group-call) and mixed-impl
  group mode (--reference-participants), with SDP munging for simulcast
- H264 simulcast group video (FakeVideoTrackSource pattern generator,
  FakeVideoSink frame counting, --video flag, two-pass channel setup,
  reactive video setup from ActiveVideoSsrcs)
- Group churn stress mode (--mode group-churn, --churn-cycles)
- SFU stream-quality adaptation: BandwidthEstimator, LayerSelector
  state machine, RtxRingBuffer, simulcast SSRC rewrite
- Transport-cc feedback generation, NetworkSimulator (delay/jitter/loss/
  token-bucket bandwidth), --network-scenario step-down-up
- CLAUDE.md updates throughout

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

301 lines
11 KiB
Text

load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test")
config_setting(
name = "debug_build",
values = {
"compilation_mode": "dbg",
},
)
config_setting(
name = "is_macos",
constraint_values = ["@platforms//os:macos"],
)
optimization_flags = select({
":debug_build": [
],
"//conditions:default": ["-DNDEBUG"],
})
sources = glob([
"Sources/**/*.m",
"Sources/**/*.mm",
"Sources/**/*.h",
"tgcalls/tgcalls/**/*.h",
"tgcalls/tgcalls/**/*.hpp",
"tgcalls/tgcalls/**/*.cpp",
"tgcalls/tgcalls/**/*.mm",
"tgcalls/tgcalls/**/*.m",
], allow_empty=True, exclude = [
"tgcalls/tgcalls/legacy/**",
"tgcalls/tgcalls/platform/tdesktop/**",
"tgcalls/tgcalls/platform/android/**",
"tgcalls/tgcalls/platform/windows/**",
"tgcalls/tgcalls/platform/uwp/**",
"tgcalls/tgcalls/platform/darwin/SQueue*",
"tgcalls/tgcalls/platform/darwin/macOS/**",
"tgcalls/tgcalls/platform/darwin/VideoCameraCapturerMac.*",
"tgcalls/tgcalls/platform/darwin/VideoMetalViewMac.*",
"tgcalls/tgcalls/platform/darwin/VideoSampleBufferViewMac.*",
"tgcalls/tgcalls/platform/darwin/GLVideoView.*",
"tgcalls/tgcalls/platform/darwin/GLVideoViewMac.*",
"tgcalls/tgcalls/platform/darwin/ScreenCapturer.*",
"tgcalls/tgcalls/platform/darwin/DesktopSharingCapturer.*",
"tgcalls/tgcalls/platform/darwin/DesktopCaptureSourceViewMac.*",
"tgcalls/tgcalls/platform/darwin/DesktopCaptureSourceView.*",
"tgcalls/tgcalls/platform/darwin/TGCMIODevice.*",
"tgcalls/tgcalls/platform/darwin/TGCMIOCapturer.*",
"tgcalls/tgcalls/platform/darwin/VideoCMIOCapture.*",
"tgcalls/tgcalls/desktop_capturer/**",
])
sources = glob([
"Sources/**/*.m",
"Sources/**/*.mm",
"Sources/**/*.h",
"tgcalls/tgcalls/**/*.h",
"tgcalls/tgcalls/**/*.hpp",
"tgcalls/tgcalls/platform/darwin/**/*.cpp",
"tgcalls/tgcalls/platform/darwin/**/*.m",
"tgcalls/tgcalls/platform/darwin/**/*.mm",
"tgcalls/tgcalls/platform/darwin/**/*.cc",
"tgcalls/tgcalls/platform/darwin/**/*.c",
"tgcalls/tgcalls/third-party/**/*.cpp",
"tgcalls/tgcalls/utils/**/*.cpp",
], allow_empty=True, exclude = [
"tgcalls/tgcalls/legacy/**",
"tgcalls/tgcalls/platform/tdesktop/**",
"tgcalls/tgcalls/platform/android/**",
"tgcalls/tgcalls/platform/windows/**",
"tgcalls/tgcalls/platform/uwp/**",
"tgcalls/tgcalls/platform/darwin/SQueue*",
"tgcalls/tgcalls/platform/darwin/macOS/**",
"tgcalls/tgcalls/platform/darwin/VideoCameraCapturerMac.*",
"tgcalls/tgcalls/platform/darwin/VideoMetalViewMac.*",
"tgcalls/tgcalls/platform/darwin/VideoSampleBufferViewMac.*",
"tgcalls/tgcalls/platform/darwin/GLVideoView.*",
"tgcalls/tgcalls/platform/darwin/GLVideoViewMac.*",
"tgcalls/tgcalls/platform/darwin/ScreenCapturer.*",
"tgcalls/tgcalls/platform/darwin/DesktopSharingCapturer.*",
"tgcalls/tgcalls/platform/darwin/DesktopCaptureSourceViewMac.*",
"tgcalls/tgcalls/platform/darwin/DesktopCaptureSourceView.*",
"tgcalls/tgcalls/platform/darwin/TGCMIODevice.*",
"tgcalls/tgcalls/platform/darwin/TGCMIOCapturer.*",
"tgcalls/tgcalls/platform/darwin/VideoCMIOCapture.*",
"tgcalls/tgcalls/desktop_capturer/**",
]) + [
"tgcalls/tgcalls/Manager.cpp",
"tgcalls/tgcalls/MediaManager.cpp",
"tgcalls/tgcalls/AudioDeviceHelper.cpp",
"tgcalls/tgcalls/ChannelManager.cpp",
"tgcalls/tgcalls/CodecSelectHelper.cpp",
"tgcalls/tgcalls/CryptoHelper.cpp",
"tgcalls/tgcalls/EncryptedConnection.cpp",
"tgcalls/tgcalls/FakeAudioDeviceModule.cpp",
"tgcalls/tgcalls/FakeVideoTrackSource.cpp",
"tgcalls/tgcalls/FieldTrialsConfig.cpp",
"tgcalls/tgcalls/Instance.cpp",
"tgcalls/tgcalls/InstanceImpl.cpp",
"tgcalls/tgcalls/LogSinkImpl.cpp",
"tgcalls/tgcalls/Message.cpp",
"tgcalls/tgcalls/NetworkManager.cpp",
"tgcalls/tgcalls/SctpDataChannelProviderInterfaceImpl.cpp",
"tgcalls/tgcalls/StaticThreads.cpp",
"tgcalls/tgcalls/ThreadLocalObject.cpp",
"tgcalls/tgcalls/TurnCustomizerImpl.cpp",
"tgcalls/tgcalls/VideoCaptureInterface.cpp",
"tgcalls/tgcalls/VideoCaptureInterfaceImpl.cpp",
"tgcalls/tgcalls/group/AudioStreamingPart.cpp",
"tgcalls/tgcalls/group/AudioStreamingPartInternal.cpp",
"tgcalls/tgcalls/group/AudioStreamingPartPersistentDecoder.cpp",
"tgcalls/tgcalls/group/AVIOContextImpl.cpp",
"tgcalls/tgcalls/group/GroupInstanceCustomImpl.cpp",
"tgcalls/tgcalls/group/GroupInstanceReferenceImpl.cpp",
"tgcalls/tgcalls/group/GroupJoinPayloadInternal.cpp",
"tgcalls/tgcalls/group/GroupNetworkManager.cpp",
"tgcalls/tgcalls/group/StreamingMediaContext.cpp",
"tgcalls/tgcalls/group/VideoStreamingPart.cpp",
"tgcalls/tgcalls/v2/ContentNegotiation.cpp",
"tgcalls/tgcalls/v2/DirectNetworkingImpl.cpp",
"tgcalls/tgcalls/v2/ExternalSignalingConnection.cpp",
"tgcalls/tgcalls/v2/InstanceV2Impl.cpp",
"tgcalls/tgcalls/v2/InstanceV2CompatImpl.cpp",
"tgcalls/tgcalls/v2/InstanceV2ReferenceImpl.cpp",
"tgcalls/tgcalls/v2/NativeNetworkingImpl.cpp",
"tgcalls/tgcalls/v2/RawTcpSocket.cpp",
"tgcalls/tgcalls/v2/ReflectorPort.cpp",
"tgcalls/tgcalls/v2/ReflectorRelayPortFactory.cpp",
"tgcalls/tgcalls/v2/Signaling.cpp",
"tgcalls/tgcalls/v2/SignalingConnection.cpp",
"tgcalls/tgcalls/v2/SignalingEncryption.cpp",
"tgcalls/tgcalls/v2/SignalingSctpConnection.cpp",
"tgcalls/tgcalls/v2/CustomDcSctpSocket.cpp",
]
objc_library(
name = "TgVoipWebrtc",
enable_modules = True,
module_name = "TgVoipWebrtc",
srcs = sources,
hdrs = glob([
"PublicHeaders/**/*.h",
]),
copts = [
"-I{}/tgcalls/tgcalls".format(package_name()),
"-Ithird-party/webrtc/webrtc",
"-Ithird-party/webrtc/dependencies",
"-Ithird-party/webrtc/webrtc/sdk/objc",
"-Ithird-party/webrtc/webrtc/sdk/objc/base",
"-Ithird-party/webrtc/webrtc/sdk/objc/components/renderer/metal",
"-Ithird-party/webrtc/webrtc/sdk/objc/components/renderer/opengl",
"-Ithird-party/webrtc/webrtc/sdk/objc/components/video_codec",
"-Ithird-party/libyuv",
"-Ithird-party/webrtc/webrtc/sdk/objc/api/video_codec",
"-Ithird-party/webrtc/absl",
"-DWEBRTC_IOS",
"-DWEBRTC_MAC",
"-DWEBRTC_POSIX",
"-DRTC_ENABLE_VP9",
"-DTGVOIP_NAMESPACE=tgvoip_webrtc",
"-std=c++17",
"-w",
#"-Werror",
] + optimization_flags,
includes = [
"PublicHeaders",
],
deps = [
"//third-party/webrtc",
"//third-party/webrtc:webrtc_objc",
"//submodules/MtProtoKit:MtProtoKit",
"//third-party/boringssl:crypto",
"//third-party/boringssl:ssl",
"//third-party/ogg:ogg",
"//third-party/opusfile:opusfile",
"//submodules/ffmpeg:ffmpeg",
"//third-party/rnnoise:rnnoise",
"//third-party/libyuv",
"//third-party/td:TdBinding",
],
sdk_frameworks = [
"Foundation",
"UIKit",
"AudioToolbox",
"VideoToolbox",
"CoreTelephony",
"CoreMedia",
"GLKit",
"AVFoundation",
],
sdk_dylibs = [
"libz",
],
visibility = [
"//visibility:public",
],
)
# Pure C++ core library for non-iOS targets (e.g. CLI tools).
# Uses FakeInterface instead of darwin platform files.
cc_library(
name = "tgcalls_core",
srcs = glob([
"tgcalls/tgcalls/**/*.h",
"tgcalls/tgcalls/**/*.hpp",
"tgcalls/tgcalls/platform/fake/**/*.cpp",
"tgcalls/tgcalls/third-party/**/*.cpp",
"tgcalls/tgcalls/utils/**/*.cpp",
], allow_empty=True, exclude = [
"tgcalls/tgcalls/legacy/**",
"tgcalls/tgcalls/platform/tdesktop/**",
"tgcalls/tgcalls/platform/android/**",
"tgcalls/tgcalls/platform/windows/**",
"tgcalls/tgcalls/platform/uwp/**",
"tgcalls/tgcalls/platform/darwin/**",
"tgcalls/tgcalls/desktop_capturer/**",
]) + [
"tgcalls/tgcalls/Manager.cpp",
"tgcalls/tgcalls/MediaManager.cpp",
"tgcalls/tgcalls/AudioDeviceHelper.cpp",
"tgcalls/tgcalls/ChannelManager.cpp",
"tgcalls/tgcalls/CodecSelectHelper.cpp",
"tgcalls/tgcalls/CryptoHelper.cpp",
"tgcalls/tgcalls/EncryptedConnection.cpp",
"tgcalls/tgcalls/FakeAudioDeviceModule.cpp",
"tgcalls/tgcalls/FakeVideoTrackSource.cpp",
"tgcalls/tgcalls/FieldTrialsConfig.cpp",
"tgcalls/tgcalls/Instance.cpp",
"tgcalls/tgcalls/InstanceImpl.cpp",
"tgcalls/tgcalls/LogSinkImpl.cpp",
"tgcalls/tgcalls/Message.cpp",
"tgcalls/tgcalls/NetworkManager.cpp",
"tgcalls/tgcalls/SctpDataChannelProviderInterfaceImpl.cpp",
"tgcalls/tgcalls/StaticThreads.cpp",
"tgcalls/tgcalls/ThreadLocalObject.cpp",
"tgcalls/tgcalls/TurnCustomizerImpl.cpp",
"tgcalls/tgcalls/VideoCaptureInterface.cpp",
"tgcalls/tgcalls/VideoCaptureInterfaceImpl.cpp",
"tgcalls/tgcalls/group/AudioStreamingPart.cpp",
"tgcalls/tgcalls/group/AudioStreamingPartInternal.cpp",
"tgcalls/tgcalls/group/AudioStreamingPartPersistentDecoder.cpp",
"tgcalls/tgcalls/group/AVIOContextImpl.cpp",
"tgcalls/tgcalls/group/GroupInstanceCustomImpl.cpp",
"tgcalls/tgcalls/group/GroupInstanceReferenceImpl.cpp",
"tgcalls/tgcalls/group/GroupJoinPayloadInternal.cpp",
"tgcalls/tgcalls/group/GroupNetworkManager.cpp",
"tgcalls/tgcalls/group/StreamingMediaContext.cpp",
"tgcalls/tgcalls/group/VideoStreamingPart.cpp",
"tgcalls/tgcalls/v2/ContentNegotiation.cpp",
"tgcalls/tgcalls/v2/DirectNetworkingImpl.cpp",
"tgcalls/tgcalls/v2/ExternalSignalingConnection.cpp",
"tgcalls/tgcalls/v2/InstanceV2Impl.cpp",
"tgcalls/tgcalls/v2/InstanceV2CompatImpl.cpp",
"tgcalls/tgcalls/v2/InstanceV2ReferenceImpl.cpp",
"tgcalls/tgcalls/v2/NativeNetworkingImpl.cpp",
"tgcalls/tgcalls/v2/RawTcpSocket.cpp",
"tgcalls/tgcalls/v2/ReflectorPort.cpp",
"tgcalls/tgcalls/v2/ReflectorRelayPortFactory.cpp",
"tgcalls/tgcalls/v2/Signaling.cpp",
"tgcalls/tgcalls/v2/SignalingConnection.cpp",
"tgcalls/tgcalls/v2/SignalingEncryption.cpp",
"tgcalls/tgcalls/v2/SignalingSctpConnection.cpp",
"tgcalls/tgcalls/v2/SignalingTranslator.cpp",
"tgcalls/tgcalls/v2/CustomDcSctpSocket.cpp",
],
copts = [
"-I{}/tgcalls/tgcalls".format(package_name()),
"-Ithird-party/webrtc/webrtc",
"-Ithird-party/webrtc/dependencies",
"-Ithird-party/webrtc/absl",
"-Ithird-party/libyuv",
"-DRTC_ENABLE_VP9",
"-DTGVOIP_NAMESPACE=tgvoip_webrtc",
"-std=c++17",
"-w",
] + select({
"@platforms//os:linux": ["-DWEBRTC_LINUX", "-DWEBRTC_POSIX"],
"//conditions:default": ["-DWEBRTC_MAC", "-DWEBRTC_POSIX"],
}) + optimization_flags,
deps = [
"//third-party/webrtc",
"//third-party/boringssl:crypto",
"//third-party/boringssl:ssl",
"//third-party/ogg:ogg",
"//third-party/opusfile:opusfile",
"//submodules/ffmpeg:ffmpeg",
"//third-party/rnnoise:rnnoise",
"//third-party/libyuv",
] + select({
":is_macos": ["//third-party/webrtc:webrtc_platform_helpers"],
"//conditions:default": [],
}),
linkopts = ["-lz"],
visibility = [
"//visibility:public",
],
)