RTCConfiguration.h 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. /*
  2. * Copyright 2015 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #import <Foundation/Foundation.h>
  11. #import <WebRTC/RTCCertificate.h>
  12. #import <WebRTC/RTCCryptoOptions.h>
  13. #import <WebRTC/RTCMacros.h>
  14. @class RTC_OBJC_TYPE(RTCIceServer);
  15. /**
  16. * Represents the ice transport policy. This exposes the same states in C++,
  17. * which include one more state than what exists in the W3C spec.
  18. */
  19. typedef NS_ENUM(NSInteger, RTCIceTransportPolicy) {
  20. RTCIceTransportPolicyNone,
  21. RTCIceTransportPolicyRelay,
  22. RTCIceTransportPolicyNoHost,
  23. RTCIceTransportPolicyAll
  24. };
  25. /** Represents the bundle policy. */
  26. typedef NS_ENUM(NSInteger, RTCBundlePolicy) {
  27. RTCBundlePolicyBalanced,
  28. RTCBundlePolicyMaxCompat,
  29. RTCBundlePolicyMaxBundle
  30. };
  31. /** Represents the rtcp mux policy. */
  32. typedef NS_ENUM(NSInteger, RTCRtcpMuxPolicy) { RTCRtcpMuxPolicyNegotiate, RTCRtcpMuxPolicyRequire };
  33. /** Represents the tcp candidate policy. */
  34. typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) {
  35. RTCTcpCandidatePolicyEnabled,
  36. RTCTcpCandidatePolicyDisabled
  37. };
  38. /** Represents the candidate network policy. */
  39. typedef NS_ENUM(NSInteger, RTCCandidateNetworkPolicy) {
  40. RTCCandidateNetworkPolicyAll,
  41. RTCCandidateNetworkPolicyLowCost
  42. };
  43. /** Represents the continual gathering policy. */
  44. typedef NS_ENUM(NSInteger, RTCContinualGatheringPolicy) {
  45. RTCContinualGatheringPolicyGatherOnce,
  46. RTCContinualGatheringPolicyGatherContinually
  47. };
  48. /** Represents the encryption key type. */
  49. typedef NS_ENUM(NSInteger, RTCEncryptionKeyType) {
  50. RTCEncryptionKeyTypeRSA,
  51. RTCEncryptionKeyTypeECDSA,
  52. };
  53. /** Represents the chosen SDP semantics for the RTCPeerConnection. */
  54. typedef NS_ENUM(NSInteger, RTCSdpSemantics) {
  55. // TODO(https://crbug.com/webrtc/13528): Remove support for Plan B.
  56. RTCSdpSemanticsPlanB,
  57. RTCSdpSemanticsUnifiedPlan,
  58. };
  59. NS_ASSUME_NONNULL_BEGIN
  60. RTC_OBJC_EXPORT
  61. @interface RTC_OBJC_TYPE (RTCConfiguration) : NSObject
  62. /** If true, allows DSCP codes to be set on outgoing packets, configured using
  63. * networkPriority field of RTCRtpEncodingParameters. Defaults to false.
  64. */
  65. @property(nonatomic, assign) BOOL enableDscp;
  66. /** An array of Ice Servers available to be used by ICE. */
  67. @property(nonatomic, copy) NSArray<RTC_OBJC_TYPE(RTCIceServer) *> *iceServers;
  68. /** An RTCCertificate for 're' use. */
  69. @property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCertificate) * certificate;
  70. /** Which candidates the ICE agent is allowed to use. The W3C calls it
  71. * `iceTransportPolicy`, while in C++ it is called `type`. */
  72. @property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy;
  73. /** The media-bundling policy to use when gathering ICE candidates. */
  74. @property(nonatomic, assign) RTCBundlePolicy bundlePolicy;
  75. /** The rtcp-mux policy to use when gathering ICE candidates. */
  76. @property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy;
  77. @property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy;
  78. @property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy;
  79. @property(nonatomic, assign) RTCContinualGatheringPolicy continualGatheringPolicy;
  80. /** If set to YES, don't gather IPv6 ICE candidates on Wi-Fi.
  81. * Only intended to be used on specific devices. Certain phones disable IPv6
  82. * when the screen is turned off and it would be better to just disable the
  83. * IPv6 ICE candidates on Wi-Fi in those cases.
  84. * Default is NO.
  85. */
  86. @property(nonatomic, assign) BOOL disableIPV6OnWiFi;
  87. /** By default, the PeerConnection will use a limited number of IPv6 network
  88. * interfaces, in order to avoid too many ICE candidate pairs being created
  89. * and delaying ICE completion.
  90. *
  91. * Can be set to INT_MAX to effectively disable the limit.
  92. */
  93. @property(nonatomic, assign) int maxIPv6Networks;
  94. /** Exclude link-local network interfaces
  95. * from considertaion for gathering ICE candidates.
  96. * Defaults to NO.
  97. */
  98. @property(nonatomic, assign) BOOL disableLinkLocalNetworks;
  99. @property(nonatomic, assign) int audioJitterBufferMaxPackets;
  100. @property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate;
  101. @property(nonatomic, assign) int iceConnectionReceivingTimeout;
  102. @property(nonatomic, assign) int iceBackupCandidatePairPingInterval;
  103. /** Key type used to generate SSL identity. Default is ECDSA. */
  104. @property(nonatomic, assign) RTCEncryptionKeyType keyType;
  105. /** ICE candidate pool size as defined in JSEP. Default is 0. */
  106. @property(nonatomic, assign) int iceCandidatePoolSize;
  107. /** Prune turn ports on the same network to the same turn server.
  108. * Default is NO.
  109. */
  110. @property(nonatomic, assign) BOOL shouldPruneTurnPorts;
  111. /** If set to YES, this means the ICE transport should presume TURN-to-TURN
  112. * candidate pairs will succeed, even before a binding response is received.
  113. */
  114. @property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed;
  115. /* This flag is only effective when `continualGatheringPolicy` is
  116. * RTCContinualGatheringPolicyGatherContinually.
  117. *
  118. * If YES, after the ICE transport type is changed such that new types of
  119. * ICE candidates are allowed by the new transport type, e.g. from
  120. * RTCIceTransportPolicyRelay to RTCIceTransportPolicyAll, candidates that
  121. * have been gathered by the ICE transport but not matching the previous
  122. * transport type and as a result not observed by PeerConnectionDelegateAdapter,
  123. * will be surfaced to the delegate.
  124. */
  125. @property(nonatomic, assign) BOOL shouldSurfaceIceCandidatesOnIceTransportTypeChanged;
  126. /** If set to non-nil, controls the minimal interval between consecutive ICE
  127. * check packets.
  128. */
  129. @property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval;
  130. /**
  131. * Configure the SDP semantics used by this PeerConnection. By default, this
  132. * is RTCSdpSemanticsUnifiedPlan which is compliant to the WebRTC 1.0
  133. * specification. It is possible to overrwite this to the deprecated
  134. * RTCSdpSemanticsPlanB SDP format, but note that RTCSdpSemanticsPlanB will be
  135. * deleted at some future date, see https://crbug.com/webrtc/13528.
  136. *
  137. * RTCSdpSemanticsUnifiedPlan will cause RTCPeerConnection to create offers and
  138. * answers with multiple m= sections where each m= section maps to one
  139. * RTCRtpSender and one RTCRtpReceiver (an RTCRtpTransceiver), either both audio
  140. * or both video. This will also cause RTCPeerConnection to ignore all but the
  141. * first a=ssrc lines that form a Plan B stream.
  142. *
  143. * RTCSdpSemanticsPlanB will cause RTCPeerConnection to create offers and
  144. * answers with at most one audio and one video m= section with multiple
  145. * RTCRtpSenders and RTCRtpReceivers specified as multiple a=ssrc lines within
  146. * the section. This will also cause RTCPeerConnection to ignore all but the
  147. * first m= section of the same media type.
  148. */
  149. @property(nonatomic, assign) RTCSdpSemantics sdpSemantics;
  150. /** Actively reset the SRTP parameters when the DTLS transports underneath are
  151. * changed after offer/answer negotiation. This is only intended to be a
  152. * workaround for crbug.com/835958
  153. */
  154. @property(nonatomic, assign) BOOL activeResetSrtpParams;
  155. /**
  156. * Defines advanced optional cryptographic settings related to SRTP and
  157. * frame encryption for native WebRTC. Setting this will overwrite any
  158. * options set through the PeerConnectionFactory (which is deprecated).
  159. */
  160. @property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCryptoOptions) * cryptoOptions;
  161. /**
  162. * An optional string that will be attached to the TURN_ALLOCATE_REQUEST which
  163. * which can be used to correlate client logs with backend logs.
  164. */
  165. @property(nonatomic, nullable, copy) NSString *turnLoggingId;
  166. /**
  167. * Time interval between audio RTCP reports.
  168. */
  169. @property(nonatomic, assign) int rtcpAudioReportIntervalMs;
  170. /**
  171. * Time interval between video RTCP reports.
  172. */
  173. @property(nonatomic, assign) int rtcpVideoReportIntervalMs;
  174. /**
  175. * Allow implicit rollback of local description when remote description
  176. * conflicts with local description.
  177. * See: https://w3c.github.io/webrtc-pc/#dom-peerconnection-setremotedescription
  178. */
  179. @property(nonatomic, assign) BOOL enableImplicitRollback;
  180. /**
  181. * Control if "a=extmap-allow-mixed" is included in the offer.
  182. * See: https://www.chromestatus.com/feature/6269234631933952
  183. */
  184. @property(nonatomic, assign) BOOL offerExtmapAllowMixed;
  185. /**
  186. * Defines the interval applied to ALL candidate pairs
  187. * when ICE is strongly connected, and it overrides the
  188. * default value of this interval in the ICE implementation;
  189. */
  190. @property(nonatomic, copy, nullable) NSNumber *iceCheckIntervalStrongConnectivity;
  191. /**
  192. * Defines the counterpart for ALL pairs when ICE is
  193. * weakly connected, and it overrides the default value of
  194. * this interval in the ICE implementation
  195. */
  196. @property(nonatomic, copy, nullable) NSNumber *iceCheckIntervalWeakConnectivity;
  197. /**
  198. * The min time period for which a candidate pair must wait for response to
  199. * connectivity checks before it becomes unwritable. This parameter
  200. * overrides the default value in the ICE implementation if set.
  201. */
  202. @property(nonatomic, copy, nullable) NSNumber *iceUnwritableTimeout;
  203. /**
  204. * The min number of connectivity checks that a candidate pair must sent
  205. * without receiving response before it becomes unwritable. This parameter
  206. * overrides the default value in the ICE implementation if set.
  207. */
  208. @property(nonatomic, copy, nullable) NSNumber *iceUnwritableMinChecks;
  209. /**
  210. * The min time period for which a candidate pair must wait for response to
  211. * connectivity checks it becomes inactive. This parameter overrides the
  212. * default value in the ICE implementation if set.
  213. */
  214. @property(nonatomic, copy, nullable) NSNumber *iceInactiveTimeout;
  215. - (instancetype)init;
  216. @end
  217. NS_ASSUME_NONNULL_END