OLD | NEW |
| (Empty) |
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 "webrtc/api/objc/RTCPeerConnection.h" | |
12 | |
13 #include "webrtc/api/peerconnectioninterface.h" | |
14 | |
15 NS_ASSUME_NONNULL_BEGIN | |
16 | |
17 namespace webrtc { | |
18 | |
19 /** | |
20 * These objects are created by RTCPeerConnectionFactory to wrap an | |
21 * id<RTCPeerConnectionDelegate> and call methods on that interface. | |
22 */ | |
23 class PeerConnectionDelegateAdapter : public PeerConnectionObserver { | |
24 | |
25 public: | |
26 PeerConnectionDelegateAdapter(RTCPeerConnection *peerConnection); | |
27 virtual ~PeerConnectionDelegateAdapter(); | |
28 | |
29 void OnSignalingChange( | |
30 PeerConnectionInterface::SignalingState new_state) override; | |
31 | |
32 void OnAddStream(MediaStreamInterface *stream) override; | |
33 | |
34 void OnRemoveStream(MediaStreamInterface *stream) override; | |
35 | |
36 void OnDataChannel(DataChannelInterface *data_channel) override; | |
37 | |
38 void OnRenegotiationNeeded() override; | |
39 | |
40 void OnIceConnectionChange( | |
41 PeerConnectionInterface::IceConnectionState new_state) override; | |
42 | |
43 void OnIceGatheringChange( | |
44 PeerConnectionInterface::IceGatheringState new_state) override; | |
45 | |
46 void OnIceCandidate(const IceCandidateInterface *candidate) override; | |
47 | |
48 private: | |
49 __weak RTCPeerConnection *peer_connection_; | |
50 }; | |
51 | |
52 } // namespace webrtc | |
53 | |
54 | |
55 @interface RTCPeerConnection () | |
56 | |
57 /** The native PeerConnectionInterface created during construction. */ | |
58 @property(nonatomic, readonly) | |
59 rtc::scoped_refptr<webrtc::PeerConnectionInterface> nativePeerConnection; | |
60 | |
61 /** Initialize an RTCPeerConnection with a configuration, constraints, and | |
62 * delegate. | |
63 */ | |
64 - (instancetype)initWithFactory: | |
65 (RTCPeerConnectionFactory *)factory | |
66 configuration: | |
67 (RTCConfiguration *)configuration | |
68 constraints: | |
69 (RTCMediaConstraints *)constraints | |
70 delegate: | |
71 (nullable id<RTCPeerConnectionDelegate>)delegate | |
72 NS_DESIGNATED_INITIALIZER; | |
73 | |
74 + (webrtc::PeerConnectionInterface::SignalingState)nativeSignalingStateForState: | |
75 (RTCSignalingState)state; | |
76 | |
77 + (RTCSignalingState)signalingStateForNativeState: | |
78 (webrtc::PeerConnectionInterface::SignalingState)nativeState; | |
79 | |
80 + (NSString *)stringForSignalingState:(RTCSignalingState)state; | |
81 | |
82 + (webrtc::PeerConnectionInterface::IceConnectionState) | |
83 nativeIceConnectionStateForState:(RTCIceConnectionState)state; | |
84 | |
85 + (RTCIceConnectionState)iceConnectionStateForNativeState: | |
86 (webrtc::PeerConnectionInterface::IceConnectionState)nativeState; | |
87 | |
88 + (NSString *)stringForIceConnectionState:(RTCIceConnectionState)state; | |
89 | |
90 + (webrtc::PeerConnectionInterface::IceGatheringState) | |
91 nativeIceGatheringStateForState:(RTCIceGatheringState)state; | |
92 | |
93 + (RTCIceGatheringState)iceGatheringStateForNativeState: | |
94 (webrtc::PeerConnectionInterface::IceGatheringState)nativeState; | |
95 | |
96 + (NSString *)stringForIceGatheringState:(RTCIceGatheringState)state; | |
97 | |
98 + (webrtc::PeerConnectionInterface::StatsOutputLevel) | |
99 nativeStatsOutputLevelForLevel:(RTCStatsOutputLevel)level; | |
100 | |
101 @end | |
102 | |
103 NS_ASSUME_NONNULL_END | |
OLD | NEW |