Files
tgcalls/Package.swift
isaac d96660ebd8 v2: range-check the SCTP timer overrides; no default Options in the constructor
Review follow-ups to 8d5e7e0, which spread the network_sctp_* overrides to
11.0.0 and 18/19:

- fromCustomParameters keeps a value only in 1...60000 ms (RFC 4960's
  RTO.Max). A negative value used to pass, and the socket factory then ran
  dcsctp's own 1000/1000/3000 ms, neither the 400/400/750 ms defaults nor the
  request, while the new log line printed the negative number. A
  seconds-for-milliseconds slip (1500000) held the first INIT retransmission
  for 25 minutes.
- getCustomParameterInt range-checks json11's double: int_value() is an
  unchecked static_cast (undefined past int's range; INT_MAX on arm64,
  INT_MIN on x86_64), and json11 parses a 10+ digit, fractional or exponent
  number as a double. A number that does not fit an int now reads as absent;
  fromCustomParameters is its only caller.
- SignalingSctpConnection's constructor takes Options with no default:
  omitting it is how 11.0.0 and 18/19 silently ran the defaults. All four
  callers already pass Options::fromCustomParameters.
- The Options field comments said "0 = use default"; a field <= 0 gets
  dcsctp's default, not the signaling one.
- SignalingSctpOptionsTest (host cc_test, //submodules/TgVoipWebrtc:
  signaling_sctp_options_test) pins absent, valid, per-key, zero, negative,
  non-number, fractional, capped and beyond-int values. Before the fix it
  failed the negative, over-cap and beyond-int cases.

CLI, 5 s fixed signaling delay, on 11, 13, 14, 18 and 19: overrides of
1500/1500/3000 still give retries 1.50 s then 3.00 s apart; -1 / 1500000 /
3e9 now keep the defaults (0.40 s, then every 0.75 s) and log
"t1_init 400 ms, t1_cookie 400 ms, max backoff 750 ms". The tgcalls host tests
and run-negotiation-tests.sh pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit c5ef736663)
2026-10-27 22:48:03 +04:00

96 lines
4.8 KiB
Swift

// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "TgVoipWebrtc",
platforms: [.macOS(.v10_13)],
products: [
.library(
name: "TgVoipWebrtc",
targets: ["TgVoipWebrtc"]),
],
dependencies: [
],
targets: [
.target(
name: "TgVoipWebrtc",
dependencies: [],
path: ".",
exclude: ["LICENSE",
"tgcalls/v2/MtProtoDtlsTransportTest.cpp",
"tgcalls/v2/SignalingSctpOptionsTest.cpp",
"README.md",
"tgcalls/platform/android",
"tgcalls/platform/tdesktop",
"tgcalls/platform/uwp",
"tgcalls/platform/fake",
"tgcalls/platform/darwin/iOS",
"tgcalls/platform/darwin/VideoCaptureView.mm",
"tgcalls/platform/darwin/VideoCaptureView.h",
"tgcalls/platform/darwin/VideoMetalView.mm",
"tgcalls/platform/darwin/VideoMetalView.h",
"tgcalls/platform/darwin/VideoSampleBufferView.mm",
"tgcalls/platform/darwin/VideoSampleBufferView.h",
"tgcalls/platform/darwin/AudioDeviceModuleIOS.h",
"tgcalls/platform/darwin/VideoCameraCapturer.mm",
"tgcalls/platform/darwin/VideoCameraCapturer.h",
"tgcalls/platform/darwin/CustomExternalCapturer.mm",
"tgcalls/platform/darwin/CustomExternalCapturer.h",
"tgcalls/group/StreamingAudioRendererTest.cpp",
"tgcalls/group/GroupFrameTransformerTest.cpp",
"tgcalls/legacy/InstanceImplLegacy.h",
"tgcalls/legacy/InstanceImplLegacy.cpp"
],
publicHeadersPath: "macos/PublicHeaders",
cxxSettings: [
.headerSearchPath("."),
.headerSearchPath("tgcalls"),
.headerSearchPath("macos/PublicHeaders"),
.headerSearchPath("SharedHeaders/webrtc"),
.headerSearchPath("SharedHeaders/webrtc/third_party/abseil-cpp"),
.headerSearchPath("SharedHeaders/webrtc/sdk/objc"),
.headerSearchPath("SharedHeaders/webrtc/sdk/objc/components/renderer/metal"),
.headerSearchPath("SharedHeaders/webrtc/sdk/objc/components/video_codec"),
.headerSearchPath("SharedHeaders/webrtc/sdk/objc/base"),
.headerSearchPath("SharedHeaders/webrtc/sdk/objc/api/video_codec"),
.headerSearchPath("SharedHeaders/webrtc/third_party/libyuv/include"),
.headerSearchPath("SharedHeaders/webrtc/sdk/objc/components/renderer/opengl"),
.headerSearchPath("SharedHeaders/openssl/include"),
.headerSearchPath("SharedHeaders/libopus/include"),
.headerSearchPath("SharedHeaders/ffmpeg/include"),
.headerSearchPath("SharedHeaders/rnoise"),
.define("WEBRTC_POSIX", to: "1", nil),
.define("WEBRTC_MAC", to: "1", nil),
//NDEBUG FLAG MUST BE THE SAME AS WEBRTC BUILT OTHERWISE IT WILL CRASH SOMEWHERE , USE _DEBUG FOR DEBUG, NDEBUG FOR RELEASE
.define("NDEBUG", to: "1", nil),
.define("RTC_ENABLE_VP9", to: "1", nil),
.define("WEBRTC_USE_BUILTIN_ISAC_FLOAT", to: "", nil),
.define("ABSL_ALLOCATOR_NOTHROW", to: "1", nil),
.define("BWE_TEST_LOGGING_COMPILE_TIME_ENABLE", to: "0", nil),
.define("HAVE_NETINET_IN_H", to: "", nil),
.define("HAVE_SCTP", to: "", nil),
.define("HAVE_WEBRTC_VIDEO", to: "", nil),
.define("NO_MAIN_THREAD_WRAPPING", to: "", nil),
.define("RTC_DISABLE_TRACE_EVENTS", to: "", nil),
.define("WEBRTC_APM_DEBUG_DUMP", to: "0", nil),
.define("WEBRTC_ARCH_ARM64", to: "", nil),
.define("WEBRTC_ENABLE_PROTOBUF", to: "0", nil),
.define("WEBRTC_HAS_NEON", to: "", nil),
.define("WEBRTC_HAVE_DCSCTP", to: "", nil),
.define("WEBRTC_HAVE_SCTP", to: "", nil),
.define("WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE", to: "", nil),
.define("WEBRTC_LIBRARY_IMPL", to: "", nil),
.define("WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS", to: "1", nil),
.define("WEBRTC_OPUS_SUPPORT_120MS_PTIME", to: "1", nil),
.define("WEBRTC_OPUS_VARIABLE_COMPLEXITY", to: "0", nil),
.define("WEBRTC_USE_H264", to: "", nil),
]),
],
cxxLanguageStandard: .cxx20
)