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