Chromium Code Reviews| Index: webrtc/api/objc/RTCPeerConnectionObserver.mm |
| diff --git a/webrtc/api/objc/RTCPeerConnectionObserver.mm b/webrtc/api/objc/RTCPeerConnectionObserver.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3150a46f65a2d7c9f76aba85ca947d79ebeadcfa |
| --- /dev/null |
| +++ b/webrtc/api/objc/RTCPeerConnectionObserver.mm |
| @@ -0,0 +1,88 @@ |
| +/* |
| + * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +#import "RTCPeerConnectionObserver.h" |
| + |
| +#import "webrtc/api/objc/RTCDataChannel+Private.h" |
| +#import "webrtc/api/objc/RTCIceCandidate+Private.h" |
| +#import "webrtc/api/objc/RTCMediaStream+Private.h" |
| +#import "webrtc/api/objc/RTCPeerConnection+Private.h" |
| + |
| +namespace webrtc { |
| + |
| +PeerConnectionDelegateAdapter::PeerConnectionDelegateAdapter( |
| + RTCPeerConnection *peerConnection) { |
| + 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
|
| +} |
| + |
| +PeerConnectionDelegateAdapter::~PeerConnectionDelegateAdapter() { |
| +} |
| + |
| +void PeerConnectionDelegateAdapter::OnSignalingChange( |
| + PeerConnectionInterface::SignalingState new_state) { |
| + RTCSignalingState state = |
| + [[RTCPeerConnection class] signalingStateForNativeState:new_state]; |
| + [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.
|
| + signalingStateChanged:state]; |
| +} |
| + |
| +void PeerConnectionDelegateAdapter::OnAddStream(MediaStreamInterface *stream) { |
| + RTCMediaStream *mediaStream = |
| + [[RTCMediaStream alloc] initWithNativeMediaStream:stream]; |
| + [peerConnection_.delegate peerConnection:peerConnection_ |
| + addedStream:mediaStream]; |
| +} |
| + |
| +void PeerConnectionDelegateAdapter::OnRemoveStream( |
| + MediaStreamInterface *stream) { |
| + RTCMediaStream *mediaStream = |
| + [[RTCMediaStream alloc] initWithNativeMediaStream:stream]; |
| + [peerConnection_.delegate peerConnection:peerConnection_ |
| + removedStream:mediaStream]; |
| +} |
| + |
| +void PeerConnectionDelegateAdapter::OnDataChannel( |
| + DataChannelInterface *data_channel) { |
| + RTCDataChannel *dataChannel = |
| + [[RTCDataChannel alloc] initWithNativeDataChannel:data_channel]; |
| + [peerConnection_.delegate peerConnection:peerConnection_ |
| + didOpenDataChannel:dataChannel]; |
| +} |
| + |
| +void PeerConnectionDelegateAdapter::OnRenegotiationNeeded() { |
| + id<RTCPeerConnectionDelegate> delegate = peerConnection_.delegate; |
| + [delegate peerConnectionNeedsRenegotiation:peerConnection_]; |
| +} |
| + |
| +void PeerConnectionDelegateAdapter::OnIceConnectionChange( |
| + PeerConnectionInterface::IceConnectionState new_state) { |
| + RTCIceConnectionState state = |
| + [[RTCPeerConnection class] iceConnectionStateForNativeState:new_state]; |
| + [peerConnection_.delegate peerConnection:peerConnection_ |
| + iceConnectionStateChanged:state]; |
| +} |
| + |
| +void PeerConnectionDelegateAdapter::OnIceGatheringChange( |
| + PeerConnectionInterface::IceGatheringState new_state) { |
| + RTCIceGatheringState state = |
| + [[RTCPeerConnection class] iceGatheringStateForNativeState:new_state]; |
| + [peerConnection_.delegate peerConnection:peerConnection_ |
| + iceGatheringStateChanged:state]; |
| +} |
| + |
| +void PeerConnectionDelegateAdapter::OnIceCandidate( |
| + const IceCandidateInterface *candidate) { |
| + RTCIceCandidate *iceCandidate = |
| + [[RTCIceCandidate alloc] initWithNativeCandidate:candidate]; |
| + [peerConnection_.delegate peerConnection:peerConnection_ |
| + receivedIceCandidate:iceCandidate]; |
| +} |
| + |
| +} // namespace webrtc |