blob: 5575af98c958fd44fdd47c165d2cc6af3028e5d3 [file] [log] [blame]
Anders Carlsson7bca8ca2018-08-30 09:30:29 +02001/*
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
15NS_ASSUME_NONNULL_BEGIN
16
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020017@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);
Yury Yaroshevich19a6e942022-03-11 09:22:08 +010032@protocol RTC_OBJC_TYPE
33(RTCSSLCertificateVerifier);
Yury Yaroshevich1d0b0ae2022-08-29 12:22:35 +020034@protocol RTC_OBJC_TYPE
35(RTCAudioDevice);
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020036
Mirko Bonadeie8d57242018-09-17 10:22:56 +020037RTC_OBJC_EXPORT
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020038@interface RTC_OBJC_TYPE (RTCPeerConnectionFactory) : NSObject
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020039
Yury Yaroshevich1d0b0ae2022-08-29 12:22:35 +020040/* Initialize object with default H264 video encoder/decoder factories and default ADM */
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020041- (instancetype)init;
42
Yury Yaroshevich1d0b0ae2022-08-29 12:22:35 +020043/* Initialize object with injectable video encoder/decoder factories and default ADM */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020044- (instancetype)
45 initWithEncoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoEncoderFactory)>)encoderFactory
46 decoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoDecoderFactory)>)decoderFactory;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020047
Yury Yaroshevich1d0b0ae2022-08-29 12:22:35 +020048/* 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
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020054/** Initialize an RTCAudioSource with constraints. */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020055- (RTC_OBJC_TYPE(RTCAudioSource) *)audioSourceWithConstraints:
56 (nullable RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020057
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020058/** Initialize an RTCAudioTrack with an id. Convenience ctor to use an audio source
59 * with no constraints.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020060 */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020061- (RTC_OBJC_TYPE(RTCAudioTrack) *)audioTrackWithTrackId:(NSString *)trackId;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020062
63/** Initialize an RTCAudioTrack with a source and an id. */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020064- (RTC_OBJC_TYPE(RTCAudioTrack) *)audioTrackWithSource:(RTC_OBJC_TYPE(RTCAudioSource) *)source
65 trackId:(NSString *)trackId;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020066
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020067/** Initialize a generic RTCVideoSource. The RTCVideoSource should be
68 * passed to a RTCVideoCapturer implementation, e.g.
69 * RTCCameraVideoCapturer, in order to produce frames.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020070 */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020071- (RTC_OBJC_TYPE(RTCVideoSource) *)videoSource;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020072
Saúl Ibarra Corretgé4d0760e2021-08-06 16:17:12 +020073/** 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
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020080/** Initialize an RTCVideoTrack with a source and an id. */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020081- (RTC_OBJC_TYPE(RTCVideoTrack) *)videoTrackWithSource:(RTC_OBJC_TYPE(RTCVideoSource) *)source
82 trackId:(NSString *)trackId;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020083
84/** Initialize an RTCMediaStream with an id. */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020085- (RTC_OBJC_TYPE(RTCMediaStream) *)mediaStreamWithStreamId:(NSString *)streamId;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020086
87/** Initialize an RTCPeerConnection with a configuration, constraints, and
88 * delegate.
89 */
Yura Yaroshevichd140c8f2021-03-02 23:25:10 +030090- (nullable RTC_OBJC_TYPE(RTCPeerConnection) *)
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020091 peerConnectionWithConfiguration:(RTC_OBJC_TYPE(RTCConfiguration) *)configuration
92 constraints:(RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints
93 delegate:(nullable id<RTC_OBJC_TYPE(RTCPeerConnectionDelegate)>)delegate;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020094
Yury Yaroshevich19a6e942022-03-11 09:22:08 +010095- (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
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200102/** Set the options to be used for subsequently created RTCPeerConnections */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +0200103- (void)setOptions:(nonnull RTC_OBJC_TYPE(RTCPeerConnectionFactoryOptions) *)options;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200104
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
113NS_ASSUME_NONNULL_END