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 "RTCPeerConnectionObserver.h" | |
12 | |
13 #import "webrtc/api/objc/RTCDataChannel+Private.h" | |
14 #import "webrtc/api/objc/RTCIceCandidate+Private.h" | |
15 #import "webrtc/api/objc/RTCMediaStream+Private.h" | |
16 #import "webrtc/api/objc/RTCPeerConnection+Private.h" | |
17 | |
18 namespace webrtc { | |
19 | |
20 PeerConnectionDelegateAdapter::PeerConnectionDelegateAdapter( | |
21 RTCPeerConnection *peerConnection) { | |
22 peerConnection_ = peerConnection; | |
tkchin_webrtc
2016/02/01 10:00:02
peerconnection_ or peer_connection_
Any reason to
hjon_webrtc
2016/02/04 00:58:38
Done.
I like the idea of just wrapping id<RTCPeer
| |
23 } | |
24 | |
25 PeerConnectionDelegateAdapter::~PeerConnectionDelegateAdapter() { | |
26 } | |
27 | |
28 void PeerConnectionDelegateAdapter::OnSignalingChange( | |
29 PeerConnectionInterface::SignalingState new_state) { | |
30 RTCSignalingState state = | |
31 [[RTCPeerConnection class] signalingStateForNativeState:new_state]; | |
32 [peerConnection_.delegate peerConnection:peerConnection_ | |
tkchin_webrtc
2016/02/01 10:00:02
You'll want to pull out peerconnection to a local
hjon_webrtc
2016/02/04 00:58:38
Done.
| |
33 signalingStateChanged:state]; | |
34 } | |
35 | |
36 void PeerConnectionDelegateAdapter::OnAddStream(MediaStreamInterface *stream) { | |
37 RTCMediaStream *mediaStream = | |
38 [[RTCMediaStream alloc] initWithNativeMediaStream:stream]; | |
39 [peerConnection_.delegate peerConnection:peerConnection_ | |
40 addedStream:mediaStream]; | |
41 } | |
42 | |
43 void PeerConnectionDelegateAdapter::OnRemoveStream( | |
44 MediaStreamInterface *stream) { | |
45 RTCMediaStream *mediaStream = | |
46 [[RTCMediaStream alloc] initWithNativeMediaStream:stream]; | |
47 [peerConnection_.delegate peerConnection:peerConnection_ | |
48 removedStream:mediaStream]; | |
49 } | |
50 | |
51 void PeerConnectionDelegateAdapter::OnDataChannel( | |
52 DataChannelInterface *data_channel) { | |
53 RTCDataChannel *dataChannel = | |
54 [[RTCDataChannel alloc] initWithNativeDataChannel:data_channel]; | |
55 [peerConnection_.delegate peerConnection:peerConnection_ | |
56 didOpenDataChannel:dataChannel]; | |
57 } | |
58 | |
59 void PeerConnectionDelegateAdapter::OnRenegotiationNeeded() { | |
60 id<RTCPeerConnectionDelegate> delegate = peerConnection_.delegate; | |
61 [delegate peerConnectionNeedsRenegotiation:peerConnection_]; | |
62 } | |
63 | |
64 void PeerConnectionDelegateAdapter::OnIceConnectionChange( | |
65 PeerConnectionInterface::IceConnectionState new_state) { | |
66 RTCIceConnectionState state = | |
67 [[RTCPeerConnection class] iceConnectionStateForNativeState:new_state]; | |
68 [peerConnection_.delegate peerConnection:peerConnection_ | |
69 iceConnectionStateChanged:state]; | |
70 } | |
71 | |
72 void PeerConnectionDelegateAdapter::OnIceGatheringChange( | |
73 PeerConnectionInterface::IceGatheringState new_state) { | |
74 RTCIceGatheringState state = | |
75 [[RTCPeerConnection class] iceGatheringStateForNativeState:new_state]; | |
76 [peerConnection_.delegate peerConnection:peerConnection_ | |
77 iceGatheringStateChanged:state]; | |
78 } | |
79 | |
80 void PeerConnectionDelegateAdapter::OnIceCandidate( | |
81 const IceCandidateInterface *candidate) { | |
82 RTCIceCandidate *iceCandidate = | |
83 [[RTCIceCandidate alloc] initWithNativeCandidate:candidate]; | |
84 [peerConnection_.delegate peerConnection:peerConnection_ | |
85 receivedIceCandidate:iceCandidate]; | |
86 } | |
87 | |
88 } // namespace webrtc | |
OLD | NEW |