You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
8.3 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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 RTCIceServer;
  15. @class RTCIntervalRange;
  16. /**
  17. * Represents the ice transport policy. This exposes the same states in C++,
  18. * which include one more state than what exists in the W3C spec.
  19. */
  20. typedef NS_ENUM(NSInteger, RTCIceTransportPolicy) {
  21. RTCIceTransportPolicyNone,
  22. RTCIceTransportPolicyRelay,
  23. RTCIceTransportPolicyNoHost,
  24. RTCIceTransportPolicyAll
  25. };
  26. /** Represents the bundle policy. */
  27. typedef NS_ENUM(NSInteger, RTCBundlePolicy) {
  28. RTCBundlePolicyBalanced,
  29. RTCBundlePolicyMaxCompat,
  30. RTCBundlePolicyMaxBundle
  31. };
  32. /** Represents the rtcp mux policy. */
  33. typedef NS_ENUM(NSInteger, RTCRtcpMuxPolicy) { RTCRtcpMuxPolicyNegotiate, RTCRtcpMuxPolicyRequire };
  34. /** Represents the tcp candidate policy. */
  35. typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) {
  36. RTCTcpCandidatePolicyEnabled,
  37. RTCTcpCandidatePolicyDisabled
  38. };
  39. /** Represents the candidate network policy. */
  40. typedef NS_ENUM(NSInteger, RTCCandidateNetworkPolicy) {
  41. RTCCandidateNetworkPolicyAll,
  42. RTCCandidateNetworkPolicyLowCost
  43. };
  44. /** Represents the continual gathering policy. */
  45. typedef NS_ENUM(NSInteger, RTCContinualGatheringPolicy) {
  46. RTCContinualGatheringPolicyGatherOnce,
  47. RTCContinualGatheringPolicyGatherContinually
  48. };
  49. /** Represents the encryption key type. */
  50. typedef NS_ENUM(NSInteger, RTCEncryptionKeyType) {
  51. RTCEncryptionKeyTypeRSA,
  52. RTCEncryptionKeyTypeECDSA,
  53. };
  54. /** Represents the chosen SDP semantics for the RTCPeerConnection. */
  55. typedef NS_ENUM(NSInteger, RTCSdpSemantics) {
  56. RTCSdpSemanticsPlanB,
  57. RTCSdpSemanticsUnifiedPlan,
  58. };
  59. NS_ASSUME_NONNULL_BEGIN
  60. RTC_OBJC_EXPORT
  61. @interface RTCConfiguration : NSObject
  62. /** An array of Ice Servers available to be used by ICE. */
  63. @property(nonatomic, copy) NSArray<RTCIceServer *> *iceServers;
  64. /** An RTCCertificate for 're' use. */
  65. @property(nonatomic, nullable) RTCCertificate *certificate;
  66. /** Which candidates the ICE agent is allowed to use. The W3C calls it
  67. * |iceTransportPolicy|, while in C++ it is called |type|. */
  68. @property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy;
  69. /** The media-bundling policy to use when gathering ICE candidates. */
  70. @property(nonatomic, assign) RTCBundlePolicy bundlePolicy;
  71. /** The rtcp-mux policy to use when gathering ICE candidates. */
  72. @property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy;
  73. @property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy;
  74. @property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy;
  75. @property(nonatomic, assign) RTCContinualGatheringPolicy continualGatheringPolicy;
  76. /** If set to YES, don't gather IPv6 ICE candidates.
  77. * Default is NO.
  78. */
  79. @property(nonatomic, assign) BOOL disableIPV6;
  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. /** ICE Periodic Regathering
  131. * If set, WebRTC will periodically create and propose candidates without
  132. * starting a new ICE generation. The regathering happens continuously with
  133. * interval specified in milliseconds by the uniform distribution [a, b].
  134. */
  135. @property(nonatomic, strong, nullable) RTCIntervalRange *iceRegatherIntervalRange;
  136. /** Configure the SDP semantics used by this PeerConnection. Note that the
  137. * WebRTC 1.0 specification requires UnifiedPlan semantics. The
  138. * RTCRtpTransceiver API is only available with UnifiedPlan semantics.
  139. *
  140. * PlanB will cause RTCPeerConnection to create offers and answers with at
  141. * most one audio and one video m= section with multiple RTCRtpSenders and
  142. * RTCRtpReceivers specified as multiple a=ssrc lines within the section. This
  143. * will also cause RTCPeerConnection to ignore all but the first m= section of
  144. * the same media type.
  145. *
  146. * UnifiedPlan will cause RTCPeerConnection to create offers and answers with
  147. * multiple m= sections where each m= section maps to one RTCRtpSender and one
  148. * RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both video. This
  149. * will also cause RTCPeerConnection to ignore all but the first a=ssrc lines
  150. * that form a Plan B stream.
  151. *
  152. * For users who wish to send multiple audio/video streams and need to stay
  153. * interoperable with legacy WebRTC implementations or use legacy APIs,
  154. * specify PlanB.
  155. *
  156. * For all other users, specify UnifiedPlan.
  157. */
  158. @property(nonatomic, assign) RTCSdpSemantics sdpSemantics;
  159. /** Actively reset the SRTP parameters when the DTLS transports underneath are
  160. * changed after offer/answer negotiation. This is only intended to be a
  161. * workaround for crbug.com/835958
  162. */
  163. @property(nonatomic, assign) BOOL activeResetSrtpParams;
  164. /**
  165. * If MediaTransportFactory is provided in PeerConnectionFactory, this flag informs PeerConnection
  166. * that it should use the MediaTransportInterface.
  167. */
  168. @property(nonatomic, assign) BOOL useMediaTransport;
  169. /**
  170. * If MediaTransportFactory is provided in PeerConnectionFactory, this flag informs PeerConnection
  171. * that it should use the MediaTransportInterface for data channels.
  172. */
  173. @property(nonatomic, assign) BOOL useMediaTransportForDataChannels;
  174. /**
  175. * Defines advanced optional cryptographic settings related to SRTP and
  176. * frame encryption for native WebRTC. Setting this will overwrite any
  177. * options set through the PeerConnectionFactory (which is deprecated).
  178. */
  179. @property(nonatomic, nullable) RTCCryptoOptions *cryptoOptions;
  180. /**
  181. * Time interval between audio RTCP reports.
  182. */
  183. @property(nonatomic, assign) int rtcpAudioReportIntervalMs;
  184. /**
  185. * Time interval between video RTCP reports.
  186. */
  187. @property(nonatomic, assign) int rtcpVideoReportIntervalMs;
  188. - (instancetype)init;
  189. @end
  190. NS_ASSUME_NONNULL_END