| 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/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(rtc::scoped_refptr<MediaStreamInterface> stream) override; | |
| 33 | |
| 34 void OnRemoveStream(rtc::scoped_refptr<MediaStreamInterface> stream) override; | |
| 35 | |
| 36 void OnDataChannel( | |
| 37 rtc::scoped_refptr<DataChannelInterface> data_channel) override; | |
| 38 | |
| 39 void OnRenegotiationNeeded() override; | |
| 40 | |
| 41 void OnIceConnectionChange( | |
| 42 PeerConnectionInterface::IceConnectionState new_state) override; | |
| 43 | |
| 44 void OnIceGatheringChange( | |
| 45 PeerConnectionInterface::IceGatheringState new_state) override; | |
| 46 | |
| 47 void OnIceCandidate(const IceCandidateInterface *candidate) override; | |
| 48 | |
| 49 void OnIceCandidatesRemoved( | |
| 50 const std::vector<cricket::Candidate>& candidates) override; | |
| 51 | |
| 52 private: | |
| 53 __weak RTCPeerConnection *peer_connection_; | |
| 54 }; | |
| 55 | |
| 56 } // namespace webrtc | |
| 57 | |
| 58 | |
| 59 @interface RTCPeerConnection () | |
| 60 | |
| 61 /** The native PeerConnectionInterface created during construction. */ | |
| 62 @property(nonatomic, readonly) | |
| 63 rtc::scoped_refptr<webrtc::PeerConnectionInterface> nativePeerConnection; | |
| 64 | |
| 65 /** Initialize an RTCPeerConnection with a configuration, constraints, and | |
| 66 * delegate. | |
| 67 */ | |
| 68 - (instancetype)initWithFactory: | |
| 69 (RTCPeerConnectionFactory *)factory | |
| 70 configuration: | |
| 71 (RTCConfiguration *)configuration | |
| 72 constraints: | |
| 73 (RTCMediaConstraints *)constraints | |
| 74 delegate: | |
| 75 (nullable id<RTCPeerConnectionDelegate>)delegate | |
| 76 NS_DESIGNATED_INITIALIZER; | |
| 77 | |
| 78 + (webrtc::PeerConnectionInterface::SignalingState)nativeSignalingStateForState: | |
| 79 (RTCSignalingState)state; | |
| 80 | |
| 81 + (RTCSignalingState)signalingStateForNativeState: | |
| 82 (webrtc::PeerConnectionInterface::SignalingState)nativeState; | |
| 83 | |
| 84 + (NSString *)stringForSignalingState:(RTCSignalingState)state; | |
| 85 | |
| 86 + (webrtc::PeerConnectionInterface::IceConnectionState) | |
| 87 nativeIceConnectionStateForState:(RTCIceConnectionState)state; | |
| 88 | |
| 89 + (RTCIceConnectionState)iceConnectionStateForNativeState: | |
| 90 (webrtc::PeerConnectionInterface::IceConnectionState)nativeState; | |
| 91 | |
| 92 + (NSString *)stringForIceConnectionState:(RTCIceConnectionState)state; | |
| 93 | |
| 94 + (webrtc::PeerConnectionInterface::IceGatheringState) | |
| 95 nativeIceGatheringStateForState:(RTCIceGatheringState)state; | |
| 96 | |
| 97 + (RTCIceGatheringState)iceGatheringStateForNativeState: | |
| 98 (webrtc::PeerConnectionInterface::IceGatheringState)nativeState; | |
| 99 | |
| 100 + (NSString *)stringForIceGatheringState:(RTCIceGatheringState)state; | |
| 101 | |
| 102 + (webrtc::PeerConnectionInterface::StatsOutputLevel) | |
| 103 nativeStatsOutputLevelForLevel:(RTCStatsOutputLevel)level; | |
| 104 | |
| 105 @end | |
| 106 | |
| 107 NS_ASSUME_NONNULL_END | |
| OLD | NEW |