RTCConfiguration.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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 "RTCCertificate.h"
  12. #import "RTCCryptoOptions.h"
  13. #import "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. RTCSdpSemanticsPlanB,
  56. RTCSdpSemanticsUnifiedPlan,
  57. };
  58. NS_ASSUME_NONNULL_BEGIN
  59. RTC_OBJC_EXPORT
  60. @interface RTC_OBJC_TYPE (RTCConfiguration) : NSObject
  61. /** If true, allows DSCP codes to be set on outgoing packets, configured using
  62. * networkPriority field of RTCRtpEncodingParameters. Defaults to false.
  63. */
  64. @property(nonatomic, assign) BOOL enableDscp;
  65. /** An array of Ice Servers available to be used by ICE. */
  66. @property(nonatomic, copy) NSArray<RTC_OBJC_TYPE(RTCIceServer) *> *iceServers;
  67. /** An RTCCertificate for 're' use. */
  68. @property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCertificate) * certificate;
  69. /** Which candidates the ICE agent is allowed to use. The W3C calls it
  70. * |iceTransportPolicy|, while in C++ it is called |type|. */
  71. @property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy;
  72. /** The media-bundling policy to use when gathering ICE candidates. */
  73. @property(nonatomic, assign) RTCBundlePolicy bundlePolicy;
  74. /** The rtcp-mux policy to use when gathering ICE candidates. */
  75. @property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy;
  76. @property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy;
  77. @property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy;
  78. @property(nonatomic, assign) RTCContinualGatheringPolicy continualGatheringPolicy;
  79. /** If set to YES, don't gather IPv6 ICE candidates.
  80. * Default is NO.
  81. */
  82. @property(nonatomic, assign) BOOL disableIPV6;
  83. /** If set to YES, don't gather IPv6 ICE candidates on Wi-Fi.
  84. * Only intended to be used on specific devices. Certain phones disable IPv6
  85. * when the screen is turned off and it would be better to just disable the
  86. * IPv6 ICE candidates on Wi-Fi in those cases.
  87. * Default is NO.
  88. */
  89. @property(nonatomic, assign) BOOL disableIPV6OnWiFi;
  90. /** By default, the PeerConnection will use a limited number of IPv6 network
  91. * interfaces, in order to avoid too many ICE candidate pairs being created
  92. * and delaying ICE completion.
  93. *
  94. * Can be set to INT_MAX to effectively disable the limit.
  95. */
  96. @property(nonatomic, assign) int maxIPv6Networks;
  97. /** Exclude link-local network interfaces
  98. * from considertaion for gathering ICE candidates.
  99. * Defaults to NO.
  100. */
  101. @property(nonatomic, assign) BOOL disableLinkLocalNetworks;
  102. @property(nonatomic, assign) int audioJitterBufferMaxPackets;
  103. @property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate;
  104. @property(nonatomic, assign) int iceConnectionReceivingTimeout;
  105. @property(nonatomic, assign) int iceBackupCandidatePairPingInterval;
  106. /** Key type used to generate SSL identity. Default is ECDSA. */
  107. @property(nonatomic, assign) RTCEncryptionKeyType keyType;
  108. /** ICE candidate pool size as defined in JSEP. Default is 0. */
  109. @property(nonatomic, assign) int iceCandidatePoolSize;
  110. /** Prune turn ports on the same network to the same turn server.
  111. * Default is NO.
  112. */
  113. @property(nonatomic, assign) BOOL shouldPruneTurnPorts;
  114. /** If set to YES, this means the ICE transport should presume TURN-to-TURN
  115. * candidate pairs will succeed, even before a binding response is received.
  116. */
  117. @property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed;
  118. /* This flag is only effective when |continualGatheringPolicy| is
  119. * RTCContinualGatheringPolicyGatherContinually.
  120. *
  121. * If YES, after the ICE transport type is changed such that new types of
  122. * ICE candidates are allowed by the new transport type, e.g. from
  123. * RTCIceTransportPolicyRelay to RTCIceTransportPolicyAll, candidates that
  124. * have been gathered by the ICE transport but not matching the previous
  125. * transport type and as a result not observed by PeerConnectionDelegateAdapter,
  126. * will be surfaced to the delegate.
  127. */
  128. @property(nonatomic, assign) BOOL shouldSurfaceIceCandidatesOnIceTransportTypeChanged;
  129. /** If set to non-nil, controls the minimal interval between consecutive ICE
  130. * check packets.
  131. */
  132. @property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval;
  133. /** Configure the SDP semantics used by this PeerConnection. Note that the
  134. * WebRTC 1.0 specification requires UnifiedPlan semantics. The
  135. * RTCRtpTransceiver API is only available with UnifiedPlan semantics.
  136. *
  137. * PlanB will cause RTCPeerConnection to create offers and answers with at
  138. * most one audio and one video m= section with multiple RTCRtpSenders and
  139. * RTCRtpReceivers specified as multiple a=ssrc lines within the section. This
  140. * will also cause RTCPeerConnection to ignore all but the first m= section of
  141. * the same media type.
  142. *
  143. * UnifiedPlan will cause RTCPeerConnection to create offers and answers with
  144. * multiple m= sections where each m= section maps to one RTCRtpSender and one
  145. * RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both
  146. * video. This will also cause RTCPeerConnection) to ignore all but the first a=ssrc
  147. * lines that form a Plan B stream.
  148. *
  149. * For users who wish to send multiple audio/video streams and need to stay
  150. * interoperable with legacy WebRTC implementations or use legacy APIs,
  151. * specify PlanB.
  152. *
  153. * For all other users, specify UnifiedPlan.
  154. */
  155. @property(nonatomic, assign) RTCSdpSemantics sdpSemantics;
  156. /** Actively reset the SRTP parameters when the DTLS transports underneath are
  157. * changed after offer/answer negotiation. This is only intended to be a
  158. * workaround for crbug.com/835958
  159. */
  160. @property(nonatomic, assign) BOOL activeResetSrtpParams;
  161. /** If the remote side support mid-stream codec switches then allow encoder
  162. * switching to be performed.
  163. */
  164. @property(nonatomic, assign) BOOL allowCodecSwitching;
  165. /**
  166. * Defines advanced optional cryptographic settings related to SRTP and
  167. * frame encryption for native WebRTC. Setting this will overwrite any
  168. * options set through the PeerConnectionFactory (which is deprecated).
  169. */
  170. @property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCryptoOptions) * cryptoOptions;
  171. /**
  172. * Time interval between audio RTCP reports.
  173. */
  174. @property(nonatomic, assign) int rtcpAudioReportIntervalMs;
  175. /**
  176. * Time interval between video RTCP reports.
  177. */
  178. @property(nonatomic, assign) int rtcpVideoReportIntervalMs;
  179. - (instancetype)init;
  180. @end
  181. NS_ASSUME_NONNULL_END