rtc.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. /**
  2. * Copyright (c) 2019-2021 Paul-Louis Ageneau
  3. *
  4. * This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at https://mozilla.org/MPL/2.0/.
  7. */
  8. #ifndef RTC_C_API
  9. #define RTC_C_API
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. #ifdef RTC_STATIC
  14. #define RTC_C_EXPORT
  15. #else // dynamic library
  16. #ifdef _WIN32
  17. #ifdef RTC_EXPORTS
  18. #define RTC_C_EXPORT __declspec(dllexport) // building the library
  19. #else
  20. #define RTC_C_EXPORT __declspec(dllimport) // using the library
  21. #endif
  22. #else // not WIN32
  23. #define RTC_C_EXPORT
  24. #endif
  25. #endif
  26. #ifdef _WIN32
  27. #ifdef CAPI_STDCALL
  28. #define RTC_API __stdcall
  29. #else
  30. #define RTC_API
  31. #endif
  32. #else // not WIN32
  33. #define RTC_API
  34. #endif
  35. #ifndef RTC_ENABLE_WEBSOCKET
  36. #define RTC_ENABLE_WEBSOCKET 1
  37. #endif
  38. #ifndef RTC_ENABLE_MEDIA
  39. #define RTC_ENABLE_MEDIA 1
  40. #endif
  41. #define RTC_DEFAULT_MTU 1280 // IPv6 minimum guaranteed MTU
  42. #if RTC_ENABLE_MEDIA
  43. #define RTC_DEFAULT_MAXIMUM_FRAGMENT_SIZE \
  44. ((uint16_t)(RTC_DEFAULT_MTU - 12 - 8 - 40)) // SRTP/UDP/IPv6
  45. #define RTC_DEFAULT_MAXIMUM_PACKET_COUNT_FOR_NACK_CACHE ((unsigned)512)
  46. #endif
  47. #include <stdbool.h>
  48. #include <stdint.h>
  49. // libdatachannel C API
  50. typedef enum {
  51. RTC_NEW = 0,
  52. RTC_CONNECTING = 1,
  53. RTC_CONNECTED = 2,
  54. RTC_DISCONNECTED = 3,
  55. RTC_FAILED = 4,
  56. RTC_CLOSED = 5
  57. } rtcState;
  58. typedef enum {
  59. RTC_ICE_NEW = 0,
  60. RTC_ICE_CHECKING = 1,
  61. RTC_ICE_CONNECTED = 2,
  62. RTC_ICE_COMPLETED = 3,
  63. RTC_ICE_FAILED = 4,
  64. RTC_ICE_DISCONNECTED = 5,
  65. RTC_ICE_CLOSED = 6
  66. } rtcIceState;
  67. typedef enum {
  68. RTC_GATHERING_NEW = 0,
  69. RTC_GATHERING_INPROGRESS = 1,
  70. RTC_GATHERING_COMPLETE = 2
  71. } rtcGatheringState;
  72. typedef enum {
  73. RTC_SIGNALING_STABLE = 0,
  74. RTC_SIGNALING_HAVE_LOCAL_OFFER = 1,
  75. RTC_SIGNALING_HAVE_REMOTE_OFFER = 2,
  76. RTC_SIGNALING_HAVE_LOCAL_PRANSWER = 3,
  77. RTC_SIGNALING_HAVE_REMOTE_PRANSWER = 4,
  78. } rtcSignalingState;
  79. typedef enum { // Don't change, it must match plog severity
  80. RTC_LOG_NONE = 0,
  81. RTC_LOG_FATAL = 1,
  82. RTC_LOG_ERROR = 2,
  83. RTC_LOG_WARNING = 3,
  84. RTC_LOG_INFO = 4,
  85. RTC_LOG_DEBUG = 5,
  86. RTC_LOG_VERBOSE = 6
  87. } rtcLogLevel;
  88. typedef enum {
  89. RTC_CERTIFICATE_DEFAULT = 0, // ECDSA
  90. RTC_CERTIFICATE_ECDSA = 1,
  91. RTC_CERTIFICATE_RSA = 2,
  92. } rtcCertificateType;
  93. typedef enum {
  94. // video
  95. RTC_CODEC_H264 = 0,
  96. RTC_CODEC_VP8 = 1,
  97. RTC_CODEC_VP9 = 2,
  98. RTC_CODEC_H265 = 3,
  99. RTC_CODEC_AV1 = 4,
  100. // audio
  101. RTC_CODEC_OPUS = 128,
  102. RTC_CODEC_PCMU = 129,
  103. RTC_CODEC_PCMA = 130,
  104. RTC_CODEC_AAC = 131,
  105. } rtcCodec;
  106. typedef enum {
  107. RTC_DIRECTION_UNKNOWN = 0,
  108. RTC_DIRECTION_SENDONLY = 1,
  109. RTC_DIRECTION_RECVONLY = 2,
  110. RTC_DIRECTION_SENDRECV = 3,
  111. RTC_DIRECTION_INACTIVE = 4
  112. } rtcDirection;
  113. typedef enum { RTC_TRANSPORT_POLICY_ALL = 0, RTC_TRANSPORT_POLICY_RELAY = 1 } rtcTransportPolicy;
  114. #define RTC_ERR_SUCCESS 0
  115. #define RTC_ERR_INVALID -1 // invalid argument
  116. #define RTC_ERR_FAILURE -2 // runtime error
  117. #define RTC_ERR_NOT_AVAIL -3 // element not available
  118. #define RTC_ERR_TOO_SMALL -4 // buffer too small
  119. typedef void(RTC_API *rtcLogCallbackFunc)(rtcLogLevel level, const char *message);
  120. typedef void(RTC_API *rtcDescriptionCallbackFunc)(int pc, const char *sdp, const char *type,
  121. void *ptr);
  122. typedef void(RTC_API *rtcCandidateCallbackFunc)(int pc, const char *cand, const char *mid,
  123. void *ptr);
  124. typedef void(RTC_API *rtcStateChangeCallbackFunc)(int pc, rtcState state, void *ptr);
  125. typedef void(RTC_API *rtcIceStateChangeCallbackFunc)(int pc, rtcIceState state, void *ptr);
  126. typedef void(RTC_API *rtcGatheringStateCallbackFunc)(int pc, rtcGatheringState state, void *ptr);
  127. typedef void(RTC_API *rtcSignalingStateCallbackFunc)(int pc, rtcSignalingState state, void *ptr);
  128. typedef void(RTC_API *rtcDataChannelCallbackFunc)(int pc, int dc, void *ptr);
  129. typedef void(RTC_API *rtcTrackCallbackFunc)(int pc, int tr, void *ptr);
  130. typedef void(RTC_API *rtcOpenCallbackFunc)(int id, void *ptr);
  131. typedef void(RTC_API *rtcClosedCallbackFunc)(int id, void *ptr);
  132. typedef void(RTC_API *rtcErrorCallbackFunc)(int id, const char *error, void *ptr);
  133. typedef void(RTC_API *rtcMessageCallbackFunc)(int id, const char *message, int size, void *ptr);
  134. typedef void *(RTC_API *rtcInterceptorCallbackFunc)(int pc, const char *message, int size,
  135. void *ptr);
  136. typedef void(RTC_API *rtcBufferedAmountLowCallbackFunc)(int id, void *ptr);
  137. typedef void(RTC_API *rtcAvailableCallbackFunc)(int id, void *ptr);
  138. // Log
  139. // NULL cb on the first call will log to stdout
  140. RTC_C_EXPORT void rtcInitLogger(rtcLogLevel level, rtcLogCallbackFunc cb);
  141. // User pointer
  142. RTC_C_EXPORT void rtcSetUserPointer(int id, void *ptr);
  143. RTC_C_EXPORT void *rtcGetUserPointer(int i);
  144. // PeerConnection
  145. typedef struct {
  146. const char **iceServers;
  147. int iceServersCount;
  148. const char *proxyServer; // libnice only
  149. const char *bindAddress; // libjuice only, NULL means any
  150. rtcCertificateType certificateType;
  151. rtcTransportPolicy iceTransportPolicy;
  152. bool enableIceTcp; // libnice only
  153. bool enableIceUdpMux; // libjuice only
  154. bool disableAutoNegotiation;
  155. bool forceMediaTransport;
  156. uint16_t portRangeBegin; // 0 means automatic
  157. uint16_t portRangeEnd; // 0 means automatic
  158. int mtu; // <= 0 means automatic
  159. int maxMessageSize; // <= 0 means default
  160. } rtcConfiguration;
  161. RTC_C_EXPORT int rtcCreatePeerConnection(const rtcConfiguration *config); // returns pc id
  162. RTC_C_EXPORT int rtcClosePeerConnection(int pc);
  163. RTC_C_EXPORT int rtcDeletePeerConnection(int pc);
  164. RTC_C_EXPORT int rtcSetLocalDescriptionCallback(int pc, rtcDescriptionCallbackFunc cb);
  165. RTC_C_EXPORT int rtcSetLocalCandidateCallback(int pc, rtcCandidateCallbackFunc cb);
  166. RTC_C_EXPORT int rtcSetStateChangeCallback(int pc, rtcStateChangeCallbackFunc cb);
  167. RTC_C_EXPORT int rtcSetIceStateChangeCallback(int pc, rtcIceStateChangeCallbackFunc cb);
  168. RTC_C_EXPORT int rtcSetGatheringStateChangeCallback(int pc, rtcGatheringStateCallbackFunc cb);
  169. RTC_C_EXPORT int rtcSetSignalingStateChangeCallback(int pc, rtcSignalingStateCallbackFunc cb);
  170. RTC_C_EXPORT int rtcSetLocalDescription(int pc, const char *type);
  171. RTC_C_EXPORT int rtcSetRemoteDescription(int pc, const char *sdp, const char *type);
  172. RTC_C_EXPORT int rtcAddRemoteCandidate(int pc, const char *cand, const char *mid);
  173. RTC_C_EXPORT int rtcGetLocalDescription(int pc, char *buffer, int size);
  174. RTC_C_EXPORT int rtcGetRemoteDescription(int pc, char *buffer, int size);
  175. RTC_C_EXPORT int rtcGetLocalDescriptionType(int pc, char *buffer, int size);
  176. RTC_C_EXPORT int rtcGetRemoteDescriptionType(int pc, char *buffer, int size);
  177. RTC_C_EXPORT int rtcGetLocalAddress(int pc, char *buffer, int size);
  178. RTC_C_EXPORT int rtcGetRemoteAddress(int pc, char *buffer, int size);
  179. RTC_C_EXPORT int rtcGetSelectedCandidatePair(int pc, char *local, int localSize, char *remote,
  180. int remoteSize);
  181. RTC_C_EXPORT int rtcGetMaxDataChannelStream(int pc);
  182. RTC_C_EXPORT int rtcGetRemoteMaxMessageSize(int pc);
  183. // DataChannel, Track, and WebSocket common API
  184. RTC_C_EXPORT int rtcSetOpenCallback(int id, rtcOpenCallbackFunc cb);
  185. RTC_C_EXPORT int rtcSetClosedCallback(int id, rtcClosedCallbackFunc cb);
  186. RTC_C_EXPORT int rtcSetErrorCallback(int id, rtcErrorCallbackFunc cb);
  187. RTC_C_EXPORT int rtcSetMessageCallback(int id, rtcMessageCallbackFunc cb);
  188. RTC_C_EXPORT int rtcSendMessage(int id, const char *data, int size);
  189. RTC_C_EXPORT int rtcClose(int id);
  190. RTC_C_EXPORT int rtcDelete(int id);
  191. RTC_C_EXPORT bool rtcIsOpen(int id);
  192. RTC_C_EXPORT bool rtcIsClosed(int id);
  193. RTC_C_EXPORT int rtcMaxMessageSize(int id);
  194. RTC_C_EXPORT int rtcGetBufferedAmount(int id); // total size buffered to send
  195. RTC_C_EXPORT int rtcSetBufferedAmountLowThreshold(int id, int amount);
  196. RTC_C_EXPORT int rtcSetBufferedAmountLowCallback(int id, rtcBufferedAmountLowCallbackFunc cb);
  197. // DataChannel, Track, and WebSocket common extended API
  198. RTC_C_EXPORT int rtcGetAvailableAmount(int id); // total size available to receive
  199. RTC_C_EXPORT int rtcSetAvailableCallback(int id, rtcAvailableCallbackFunc cb);
  200. RTC_C_EXPORT int rtcReceiveMessage(int id, char *buffer, int *size);
  201. // DataChannel
  202. typedef struct {
  203. bool unordered;
  204. bool unreliable;
  205. int maxPacketLifeTime; // ignored if reliable
  206. int maxRetransmits; // ignored if reliable
  207. } rtcReliability;
  208. typedef struct {
  209. rtcReliability reliability;
  210. const char *protocol; // empty string if NULL
  211. bool negotiated;
  212. bool manualStream;
  213. uint16_t stream; // numeric ID 0-65534, ignored if manualStream is false
  214. } rtcDataChannelInit;
  215. RTC_C_EXPORT int rtcSetDataChannelCallback(int pc, rtcDataChannelCallbackFunc cb);
  216. RTC_C_EXPORT int rtcCreateDataChannel(int pc, const char *label); // returns dc id
  217. RTC_C_EXPORT int rtcCreateDataChannelEx(int pc, const char *label,
  218. const rtcDataChannelInit *init); // returns dc id
  219. RTC_C_EXPORT int rtcDeleteDataChannel(int dc);
  220. RTC_C_EXPORT int rtcGetDataChannelStream(int dc);
  221. RTC_C_EXPORT int rtcGetDataChannelLabel(int dc, char *buffer, int size);
  222. RTC_C_EXPORT int rtcGetDataChannelProtocol(int dc, char *buffer, int size);
  223. RTC_C_EXPORT int rtcGetDataChannelReliability(int dc, rtcReliability *reliability);
  224. // Track
  225. typedef struct {
  226. rtcDirection direction;
  227. rtcCodec codec;
  228. int payloadType;
  229. uint32_t ssrc;
  230. const char *mid;
  231. const char *name; // optional
  232. const char *msid; // optional
  233. const char *trackId; // optional, track ID used in MSID
  234. const char *profile; // optional, codec profile
  235. } rtcTrackInit;
  236. RTC_C_EXPORT int rtcSetTrackCallback(int pc, rtcTrackCallbackFunc cb);
  237. RTC_C_EXPORT int rtcAddTrack(int pc, const char *mediaDescriptionSdp); // returns tr id
  238. RTC_C_EXPORT int rtcAddTrackEx(int pc, const rtcTrackInit *init); // returns tr id
  239. RTC_C_EXPORT int rtcDeleteTrack(int tr);
  240. RTC_C_EXPORT int rtcGetTrackDescription(int tr, char *buffer, int size);
  241. RTC_C_EXPORT int rtcGetTrackMid(int tr, char *buffer, int size);
  242. RTC_C_EXPORT int rtcGetTrackDirection(int tr, rtcDirection *direction);
  243. #if RTC_ENABLE_MEDIA
  244. // Media
  245. // Define how OBUs are packetizied in a AV1 Sample
  246. typedef enum {
  247. RTC_OBU_PACKETIZED_OBU = 0,
  248. RTC_OBU_PACKETIZED_TEMPORAL_UNIT = 1,
  249. } rtcObuPacketization;
  250. // Define how NAL units are separated in a H264/H265 sample
  251. typedef enum {
  252. RTC_NAL_SEPARATOR_LENGTH = 0, // first 4 bytes are NAL unit length
  253. RTC_NAL_SEPARATOR_LONG_START_SEQUENCE = 1, // 0x00, 0x00, 0x00, 0x01
  254. RTC_NAL_SEPARATOR_SHORT_START_SEQUENCE = 2, // 0x00, 0x00, 0x01
  255. RTC_NAL_SEPARATOR_START_SEQUENCE = 3, // long or short start sequence
  256. } rtcNalUnitSeparator;
  257. typedef struct {
  258. uint32_t ssrc;
  259. const char *cname;
  260. uint8_t payloadType;
  261. uint32_t clockRate;
  262. uint16_t sequenceNumber;
  263. uint32_t timestamp;
  264. // H264/H265 only
  265. rtcNalUnitSeparator nalSeparator; // NAL unit separator
  266. // H264, H265, AV1
  267. uint16_t maxFragmentSize; // Maximum fragment size
  268. // AV1 only
  269. rtcObuPacketization obuPacketization; // OBU paketization for AV1 samples
  270. } rtcPacketizationHandlerInit;
  271. typedef struct {
  272. uint32_t ssrc;
  273. const char *name; // optional
  274. const char *msid; // optional
  275. const char *trackId; // optional, track ID used in MSID
  276. } rtcSsrcForTypeInit;
  277. // Opaque message
  278. // Opaque type used (via rtcMessage*) to reference an rtc::Message
  279. typedef void *rtcMessage;
  280. // Allocate a new opaque message.
  281. // Must be explicitly freed by rtcDeleteOpaqueMessage() unless
  282. // explicitly returned by a media interceptor callback;
  283. RTC_C_EXPORT rtcMessage *rtcCreateOpaqueMessage(void *data, int size);
  284. RTC_C_EXPORT void rtcDeleteOpaqueMessage(rtcMessage *msg);
  285. // Set MediaInterceptor for peer connection
  286. RTC_C_EXPORT int rtcSetMediaInterceptorCallback(int id, rtcInterceptorCallbackFunc cb);
  287. // Set H264PacketizationHandler for track
  288. RTC_C_EXPORT int rtcSetH264PacketizationHandler(int tr, const rtcPacketizationHandlerInit *init);
  289. // Set H265PacketizationHandler for track
  290. RTC_C_EXPORT int rtcSetH265PacketizationHandler(int tr, const rtcPacketizationHandlerInit *init);
  291. // Set AV1PacketizationHandler for track
  292. RTC_C_EXPORT int rtcSetAV1PacketizationHandler(int tr, const rtcPacketizationHandlerInit *init);
  293. // Set OpusPacketizationHandler for track
  294. RTC_C_EXPORT int rtcSetOpusPacketizationHandler(int tr, const rtcPacketizationHandlerInit *init);
  295. // Set AACPacketizationHandler for track
  296. RTC_C_EXPORT int rtcSetAACPacketizationHandler(int tr, const rtcPacketizationHandlerInit *init);
  297. // Chain RtcpSrReporter to handler chain for given track
  298. RTC_C_EXPORT int rtcChainRtcpSrReporter(int tr);
  299. // Chain RtcpNackResponder to handler chain for given track
  300. RTC_C_EXPORT int rtcChainRtcpNackResponder(int tr, unsigned int maxStoredPacketsCount);
  301. // Transform seconds to timestamp using track's clock rate, result is written to timestamp
  302. RTC_C_EXPORT int rtcTransformSecondsToTimestamp(int id, double seconds, uint32_t *timestamp);
  303. // Transform timestamp to seconds using track's clock rate, result is written to seconds
  304. RTC_C_EXPORT int rtcTransformTimestampToSeconds(int id, uint32_t timestamp, double *seconds);
  305. // Get current timestamp, result is written to timestamp
  306. RTC_C_EXPORT int rtcGetCurrentTrackTimestamp(int id, uint32_t *timestamp);
  307. // Set RTP timestamp for track identified by given id
  308. RTC_C_EXPORT int rtcSetTrackRtpTimestamp(int id, uint32_t timestamp);
  309. // Get timestamp of last RTCP SR, result is written to timestamp
  310. RTC_C_EXPORT int rtcGetLastTrackSenderReportTimestamp(int id, uint32_t *timestamp);
  311. // Set NeedsToReport flag in RtcpSrReporter handler identified by given track id
  312. RTC_C_EXPORT int rtcSetNeedsToSendRtcpSr(int id);
  313. // Get all available payload types for given codec and stores them in buffer, does nothing if
  314. // buffer is NULL
  315. int rtcGetTrackPayloadTypesForCodec(int tr, const char *ccodec, int *buffer, int size);
  316. // Get all SSRCs for given track
  317. int rtcGetSsrcsForTrack(int tr, uint32_t *buffer, int count);
  318. // Get CName for SSRC
  319. int rtcGetCNameForSsrc(int tr, uint32_t ssrc, char *cname, int cnameSize);
  320. // Get all SSRCs for given media type in given SDP
  321. int rtcGetSsrcsForType(const char *mediaType, const char *sdp, uint32_t *buffer, int bufferSize);
  322. // Set SSRC for given media type in given SDP
  323. int rtcSetSsrcForType(const char *mediaType, const char *sdp, char *buffer, const int bufferSize,
  324. rtcSsrcForTypeInit *init);
  325. #endif // RTC_ENABLE_MEDIA
  326. #if RTC_ENABLE_WEBSOCKET
  327. // WebSocket
  328. typedef struct {
  329. bool disableTlsVerification; // if true, don't verify the TLS certificate
  330. const char *proxyServer; // only non-authenticated http supported for now
  331. const char **protocols;
  332. int protocolsCount;
  333. int connectionTimeoutMs; // in milliseconds, 0 means default, < 0 means disabled
  334. int pingIntervalMs; // in milliseconds, 0 means default, < 0 means disabled
  335. int maxOutstandingPings; // 0 means default, < 0 means disabled
  336. } rtcWsConfiguration;
  337. RTC_C_EXPORT int rtcCreateWebSocket(const char *url); // returns ws id
  338. RTC_C_EXPORT int rtcCreateWebSocketEx(const char *url, const rtcWsConfiguration *config);
  339. RTC_C_EXPORT int rtcDeleteWebSocket(int ws);
  340. RTC_C_EXPORT int rtcGetWebSocketRemoteAddress(int ws, char *buffer, int size);
  341. RTC_C_EXPORT int rtcGetWebSocketPath(int ws, char *buffer, int size);
  342. // WebSocketServer
  343. typedef void(RTC_API *rtcWebSocketClientCallbackFunc)(int wsserver, int ws, void *ptr);
  344. typedef struct {
  345. uint16_t port; // 0 means automatic selection
  346. bool enableTls; // if true, enable TLS (WSS)
  347. const char *certificatePemFile; // NULL for autogenerated certificate
  348. const char *keyPemFile; // NULL for autogenerated certificate
  349. const char *keyPemPass; // NULL if no pass
  350. const char *bindAddress; // NULL for IP_ANY_ADDR
  351. int connectionTimeoutMs; // in milliseconds, 0 means default, < 0 means disabled
  352. } rtcWsServerConfiguration;
  353. RTC_C_EXPORT int rtcCreateWebSocketServer(const rtcWsServerConfiguration *config,
  354. rtcWebSocketClientCallbackFunc cb); // returns wsserver id
  355. RTC_C_EXPORT int rtcDeleteWebSocketServer(int wsserver);
  356. RTC_C_EXPORT int rtcGetWebSocketServerPort(int wsserver);
  357. #endif
  358. // Optional global preload and cleanup
  359. RTC_C_EXPORT void rtcPreload(void);
  360. RTC_C_EXPORT void rtcCleanup(void);
  361. // SCTP global settings
  362. typedef struct {
  363. int recvBufferSize; // in bytes, <= 0 means optimized default
  364. int sendBufferSize; // in bytes, <= 0 means optimized default
  365. int maxChunksOnQueue; // in chunks, <= 0 means optimized default
  366. int initialCongestionWindow; // in MTUs, <= 0 means optimized default
  367. int maxBurst; // in MTUs, 0 means optimized default, < 0 means disabled
  368. int congestionControlModule; // 0: RFC2581 (default), 1: HSTCP, 2: H-TCP, 3: RTCC
  369. int delayedSackTimeMs; // in milliseconds, 0 means optimized default, < 0 means disabled
  370. int minRetransmitTimeoutMs; // in milliseconds, <= 0 means optimized default
  371. int maxRetransmitTimeoutMs; // in milliseconds, <= 0 means optimized default
  372. int initialRetransmitTimeoutMs; // in milliseconds, <= 0 means optimized default
  373. int maxRetransmitAttempts; // number of retransmissions, <= 0 means optimized default
  374. int heartbeatIntervalMs; // in milliseconds, <= 0 means optimized default
  375. } rtcSctpSettings;
  376. // Note: SCTP settings apply to newly-created PeerConnections only
  377. RTC_C_EXPORT int rtcSetSctpSettings(const rtcSctpSettings *settings);
  378. #ifdef __cplusplus
  379. } // extern "C"
  380. #endif
  381. #endif