xref: /aosp_15_r20/external/webrtc/sdk/objc/api/peerconnection/RTCPeerConnectionFactory+Native.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2017 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 "RTCPeerConnectionFactory.h"
12 
13 #include "api/scoped_refptr.h"
14 
15 namespace webrtc {
16 
17 class AudioDeviceModule;
18 class AudioEncoderFactory;
19 class AudioDecoderFactory;
20 class NetworkControllerFactoryInterface;
21 class VideoEncoderFactory;
22 class VideoDecoderFactory;
23 class AudioProcessing;
24 struct PeerConnectionDependencies;
25 
26 }  // namespace webrtc
27 
28 NS_ASSUME_NONNULL_BEGIN
29 
30 /**
31  * This class extension exposes methods that work directly with injectable C++ components.
32  */
33 @interface RTC_OBJC_TYPE (RTCPeerConnectionFactory)
34 ()
35 
36     - (instancetype)initNative NS_DESIGNATED_INITIALIZER;
37 
38 /* Initializer used when WebRTC is compiled with no media support */
39 - (instancetype)initWithNoMedia;
40 
41 /* Initialize object with injectable native audio/video encoder/decoder factories */
42 - (instancetype)initWithNativeAudioEncoderFactory:
43                     (rtc::scoped_refptr<webrtc::AudioEncoderFactory>)audioEncoderFactory
44                         nativeAudioDecoderFactory:
45                             (rtc::scoped_refptr<webrtc::AudioDecoderFactory>)audioDecoderFactory
46                         nativeVideoEncoderFactory:
47                             (std::unique_ptr<webrtc::VideoEncoderFactory>)videoEncoderFactory
48                         nativeVideoDecoderFactory:
49                             (std::unique_ptr<webrtc::VideoDecoderFactory>)videoDecoderFactory
50                                 audioDeviceModule:
51                                     (nullable webrtc::AudioDeviceModule *)audioDeviceModule
52                             audioProcessingModule:
53                                 (rtc::scoped_refptr<webrtc::AudioProcessing>)audioProcessingModule;
54 
55 - (instancetype)
56     initWithNativeAudioEncoderFactory:
57         (rtc::scoped_refptr<webrtc::AudioEncoderFactory>)audioEncoderFactory
58             nativeAudioDecoderFactory:
59                 (rtc::scoped_refptr<webrtc::AudioDecoderFactory>)audioDecoderFactory
60             nativeVideoEncoderFactory:
61                 (std::unique_ptr<webrtc::VideoEncoderFactory>)videoEncoderFactory
62             nativeVideoDecoderFactory:
63                 (std::unique_ptr<webrtc::VideoDecoderFactory>)videoDecoderFactory
64                     audioDeviceModule:(nullable webrtc::AudioDeviceModule *)audioDeviceModule
65                 audioProcessingModule:
66                     (rtc::scoped_refptr<webrtc::AudioProcessing>)audioProcessingModule
67              networkControllerFactory:(std::unique_ptr<webrtc::NetworkControllerFactoryInterface>)
68                                           networkControllerFactory;
69 
70 - (instancetype)
71     initWithEncoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoEncoderFactory)>)encoderFactory
72             decoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoDecoderFactory)>)decoderFactory;
73 
74 /** Initialize an RTCPeerConnection with a configuration, constraints, and
75  *  dependencies.
76  */
77 - (nullable RTC_OBJC_TYPE(RTCPeerConnection) *)
78     peerConnectionWithDependencies:(RTC_OBJC_TYPE(RTCConfiguration) *)configuration
79                        constraints:(RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints
80                       dependencies:(std::unique_ptr<webrtc::PeerConnectionDependencies>)dependencies
81                           delegate:(nullable id<RTC_OBJC_TYPE(RTCPeerConnectionDelegate)>)delegate;
82 
83 @end
84 
85 NS_ASSUME_NONNULL_END
86