blob: 2b0489885f4698752bf85248d1e68d2dbabade0b [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);
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020032
Mirko Bonadeie8d57242018-09-17 10:22:56 +020033RTC_OBJC_EXPORT
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020034@interface RTC_OBJC_TYPE (RTCPeerConnectionFactory) : NSObject
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020035
36/* Initialize object with default H264 video encoder/decoder factories */
37- (instancetype)init;
38
39/* Initialize object with injectable video encoder/decoder factories */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020040- (instancetype)
41 initWithEncoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoEncoderFactory)>)encoderFactory
42 decoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoDecoderFactory)>)decoderFactory;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020043
44/** Initialize an RTCAudioSource with constraints. */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020045- (RTC_OBJC_TYPE(RTCAudioSource) *)audioSourceWithConstraints:
46 (nullable RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020047
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020048/** Initialize an RTCAudioTrack with an id. Convenience ctor to use an audio source
49 * with no constraints.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020050 */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020051- (RTC_OBJC_TYPE(RTCAudioTrack) *)audioTrackWithTrackId:(NSString *)trackId;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020052
53/** Initialize an RTCAudioTrack with a source and an id. */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020054- (RTC_OBJC_TYPE(RTCAudioTrack) *)audioTrackWithSource:(RTC_OBJC_TYPE(RTCAudioSource) *)source
55 trackId:(NSString *)trackId;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020056
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020057/** Initialize a generic RTCVideoSource. The RTCVideoSource should be
58 * passed to a RTCVideoCapturer implementation, e.g.
59 * RTCCameraVideoCapturer, in order to produce frames.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020060 */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020061- (RTC_OBJC_TYPE(RTCVideoSource) *)videoSource;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020062
63/** Initialize an RTCVideoTrack with a source and an id. */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020064- (RTC_OBJC_TYPE(RTCVideoTrack) *)videoTrackWithSource:(RTC_OBJC_TYPE(RTCVideoSource) *)source
65 trackId:(NSString *)trackId;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020066
67/** Initialize an RTCMediaStream with an id. */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020068- (RTC_OBJC_TYPE(RTCMediaStream) *)mediaStreamWithStreamId:(NSString *)streamId;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020069
70/** Initialize an RTCPeerConnection with a configuration, constraints, and
71 * delegate.
72 */
Yura Yaroshevichd140c8f2021-03-02 23:25:10 +030073- (nullable RTC_OBJC_TYPE(RTCPeerConnection) *)
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020074 peerConnectionWithConfiguration:(RTC_OBJC_TYPE(RTCConfiguration) *)configuration
75 constraints:(RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints
76 delegate:(nullable id<RTC_OBJC_TYPE(RTCPeerConnectionDelegate)>)delegate;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020077
78/** Set the options to be used for subsequently created RTCPeerConnections */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020079- (void)setOptions:(nonnull RTC_OBJC_TYPE(RTCPeerConnectionFactoryOptions) *)options;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020080
81/** Start an AecDump recording. This API call will likely change in the future. */
82- (BOOL)startAecDumpWithFilePath:(NSString *)filePath maxSizeInBytes:(int64_t)maxSizeInBytes;
83
84/* Stop an active AecDump recording */
85- (void)stopAecDump;
86
87@end
88
89NS_ASSUME_NONNULL_END