hjon | 268ca3d | 2016-02-12 00:19:06 | [diff] [blame] | 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 | + (webrtc::PeerConnectionInterface::SignalingState)nativeSignalingStateForState: |
| 62 | (RTCSignalingState)state; |
| 63 | |
| 64 | + (RTCSignalingState)signalingStateForNativeState: |
| 65 | (webrtc::PeerConnectionInterface::SignalingState)nativeState; |
| 66 | |
| 67 | + (NSString *)stringForSignalingState:(RTCSignalingState)state; |
| 68 | |
| 69 | + (webrtc::PeerConnectionInterface::IceConnectionState) |
| 70 | nativeIceConnectionStateForState:(RTCIceConnectionState)state; |
| 71 | |
| 72 | + (RTCIceConnectionState)iceConnectionStateForNativeState: |
| 73 | (webrtc::PeerConnectionInterface::IceConnectionState)nativeState; |
| 74 | |
| 75 | + (NSString *)stringForIceConnectionState:(RTCIceConnectionState)state; |
| 76 | |
| 77 | + (webrtc::PeerConnectionInterface::IceGatheringState) |
| 78 | nativeIceGatheringStateForState:(RTCIceGatheringState)state; |
| 79 | |
| 80 | + (RTCIceGatheringState)iceGatheringStateForNativeState: |
| 81 | (webrtc::PeerConnectionInterface::IceGatheringState)nativeState; |
| 82 | |
| 83 | + (NSString *)stringForIceGatheringState:(RTCIceGatheringState)state; |
| 84 | |
| 85 | + (webrtc::PeerConnectionInterface::StatsOutputLevel) |
| 86 | nativeStatsOutputLevelForLevel:(RTCStatsOutputLevel)level; |
| 87 | |
| 88 | @end |
| 89 | |
| 90 | NS_ASSUME_NONNULL_END |