RTCPeerConnectionFactory.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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/RTCMacros.h>
  12. NS_ASSUME_NONNULL_BEGIN
  13. @class RTC_OBJC_TYPE(RTCAudioSource);
  14. @class RTC_OBJC_TYPE(RTCAudioTrack);
  15. @class RTC_OBJC_TYPE(RTCConfiguration);
  16. @class RTC_OBJC_TYPE(RTCMediaConstraints);
  17. @class RTC_OBJC_TYPE(RTCMediaStream);
  18. @class RTC_OBJC_TYPE(RTCPeerConnection);
  19. @class RTC_OBJC_TYPE(RTCVideoSource);
  20. @class RTC_OBJC_TYPE(RTCVideoTrack);
  21. @class RTC_OBJC_TYPE(RTCPeerConnectionFactoryOptions);
  22. @class RTC_OBJC_TYPE(RTCAudioDeviceModule);
  23. @class RTC_OBJC_TYPE(RTCRtpCapabilities);
  24. typedef NS_ENUM(NSInteger, RTCRtpMediaType);
  25. @protocol RTC_OBJC_TYPE
  26. (RTCPeerConnectionDelegate);
  27. @protocol RTC_OBJC_TYPE
  28. (RTCVideoDecoderFactory);
  29. @protocol RTC_OBJC_TYPE
  30. (RTCVideoEncoderFactory);
  31. @protocol RTC_OBJC_TYPE
  32. (RTCSSLCertificateVerifier);
  33. @protocol RTC_OBJC_TYPE
  34. (RTCAudioDevice);
  35. @protocol RTC_OBJC_TYPE
  36. (RTCAudioProcessingModule);
  37. RTC_OBJC_EXPORT
  38. @interface RTC_OBJC_TYPE (RTCPeerConnectionFactory) : NSObject
  39. /* Initialize object with default H264 video encoder/decoder factories and default ADM */
  40. - (instancetype)init;
  41. /* Initialize object with injectable video encoder/decoder factories and default ADM */
  42. - (instancetype)
  43. initWithEncoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoEncoderFactory)>)encoderFactory
  44. decoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoDecoderFactory)>)decoderFactory;
  45. /* Initialize object with injectable video encoder/decoder factories and injectable ADM */
  46. - (instancetype)
  47. initWithEncoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoEncoderFactory)>)encoderFactory
  48. decoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoDecoderFactory)>)decoderFactory
  49. audioDevice:(nullable id<RTC_OBJC_TYPE(RTCAudioDevice)>)audioDevice;
  50. /* Initialize object with bypass voice processing */
  51. - (instancetype)
  52. initWithBypassVoiceProcessing:(BOOL)bypassVoiceProcessing
  53. encoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoEncoderFactory)>)encoderFactory
  54. decoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoDecoderFactory)>)decoderFactory
  55. audioProcessingModule:
  56. (nullable id<RTC_OBJC_TYPE(RTCAudioProcessingModule)>)audioProcessingModule;
  57. @property(nonatomic, readonly) RTCAudioDeviceModule *audioDeviceModule;
  58. - (RTC_OBJC_TYPE(RTCRtpCapabilities) *)rtpSenderCapabilitiesFor:(RTCRtpMediaType)mediaType;
  59. - (RTC_OBJC_TYPE(RTCRtpCapabilities) *)rtpReceiverCapabilitiesFor:(RTCRtpMediaType)mediaType;
  60. /** Initialize an RTCAudioSource with constraints. */
  61. - (RTC_OBJC_TYPE(RTCAudioSource) *)audioSourceWithConstraints:
  62. (nullable RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints;
  63. /** Initialize an RTCAudioTrack with an id. Convenience ctor to use an audio source
  64. * with no constraints.
  65. */
  66. - (RTC_OBJC_TYPE(RTCAudioTrack) *)audioTrackWithTrackId:(NSString *)trackId;
  67. /** Initialize an RTCAudioTrack with a source and an id. */
  68. - (RTC_OBJC_TYPE(RTCAudioTrack) *)audioTrackWithSource:(RTC_OBJC_TYPE(RTCAudioSource) *)source
  69. trackId:(NSString *)trackId;
  70. /** Initialize a generic RTCVideoSource. The RTCVideoSource should be
  71. * passed to a RTCVideoCapturer implementation, e.g.
  72. * RTCCameraVideoCapturer, in order to produce frames.
  73. */
  74. - (RTC_OBJC_TYPE(RTCVideoSource) *)videoSource;
  75. /** Initialize a generic RTCVideoSource with he posibility of marking
  76. * it as usable for screen sharing. The RTCVideoSource should be
  77. * passed to a RTCVideoCapturer implementation, e.g.
  78. * RTCCameraVideoCapturer, in order to produce frames.
  79. */
  80. - (RTC_OBJC_TYPE(RTCVideoSource) *)videoSourceForScreenCast:(BOOL)forScreenCast;
  81. /** Initialize an RTCVideoTrack with a source and an id. */
  82. - (RTC_OBJC_TYPE(RTCVideoTrack) *)videoTrackWithSource:(RTC_OBJC_TYPE(RTCVideoSource) *)source
  83. trackId:(NSString *)trackId;
  84. /** Initialize an RTCMediaStream with an id. */
  85. - (RTC_OBJC_TYPE(RTCMediaStream) *)mediaStreamWithStreamId:(NSString *)streamId;
  86. /** Initialize an RTCPeerConnection with a configuration, constraints, and
  87. * delegate.
  88. */
  89. - (nullable RTC_OBJC_TYPE(RTCPeerConnection) *)
  90. peerConnectionWithConfiguration:(RTC_OBJC_TYPE(RTCConfiguration) *)configuration
  91. constraints:(RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints
  92. delegate:(nullable id<RTC_OBJC_TYPE(RTCPeerConnectionDelegate)>)delegate;
  93. - (nullable RTC_OBJC_TYPE(RTCPeerConnection) *)
  94. peerConnectionWithConfiguration:(RTC_OBJC_TYPE(RTCConfiguration) *)configuration
  95. constraints:(RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints
  96. certificateVerifier:
  97. (id<RTC_OBJC_TYPE(RTCSSLCertificateVerifier)>)certificateVerifier
  98. delegate:(nullable id<RTC_OBJC_TYPE(RTCPeerConnectionDelegate)>)delegate;
  99. /** Set the options to be used for subsequently created RTCPeerConnections */
  100. - (void)setOptions:(nonnull RTC_OBJC_TYPE(RTCPeerConnectionFactoryOptions) *)options;
  101. /** Start an AecDump recording. This API call will likely change in the future. */
  102. - (BOOL)startAecDumpWithFilePath:(NSString *)filePath maxSizeInBytes:(int64_t)maxSizeInBytes;
  103. /* Stop an active AecDump recording */
  104. - (void)stopAecDump;
  105. @end
  106. NS_ASSUME_NONNULL_END