Index: webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm |
diff --git a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm |
index 3b7632c2b90eb1a73405c5cf64e34d485718d3ff..a294c077187c44082af8f3b52d33fceaa5e07f09 100644 |
--- a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm |
+++ b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm |
@@ -24,6 +24,7 @@ |
#include <memory> |
+#include "webrtc/api/jsepicecandidate.h" |
#include "webrtc/base/checks.h" |
NSString * const kRTCPeerConnectionErrorDomain = |
@@ -181,6 +182,23 @@ void PeerConnectionDelegateAdapter::OnIceCandidate( |
[peer_connection.delegate peerConnection:peer_connection |
didGenerateIceCandidate:iceCandidate]; |
} |
+ |
+void PeerConnectionDelegateAdapter::OnIceCandidatesRemoved( |
+ const std::vector<cricket::Candidate>& candidates) { |
+ NSMutableArray* iceCandidates = |
tkchin_webrtc
2016/05/16 20:48:58
style in this file needs to be updated. Rule is C+
honghaiz3
2016/05/17 00:46:53
Done. also replaced iceCandidate below.
|
+ [NSMutableArray arrayWithCapacity:candidates.size()]; |
+ for (const auto& candidate : candidates) { |
+ std::unique_ptr<JsepIceCandidate> candidate_wrapper( |
tkchin_webrtc
2016/05/16 20:48:58
ooc, why does new api return cricket::Candidate in
honghaiz3
2016/05/17 00:46:53
Good observation. We were doing that because we wa
|
+ new JsepIceCandidate(candidate.transport_name(), -1, candidate)); |
+ RTCIceCandidate* iceCandidate = [[RTCIceCandidate alloc] |
+ initWithNativeCandidate:candidate_wrapper.get()]; |
+ [iceCandidates addObject:iceCandidate]; |
+ } |
+ RTCPeerConnection* peer_connection = peer_connection_; |
+ [peer_connection.delegate peerConnection:peer_connection |
+ didRemoveIceCandidates:iceCandidates]; |
+} |
+ |
} // namespace webrtc |
@@ -264,6 +282,20 @@ void PeerConnectionDelegateAdapter::OnIceCandidate( |
_peerConnection->AddIceCandidate(iceCandidate.get()); |
} |
+- (void)removeRemoteIceCandidates:(NSArray<RTCIceCandidate *> *)iceCandidates { |
+ std::vector<cricket::Candidate> candidates; |
+ RTCLogInfo(@"Remove %lu remote ice candidates", |
tkchin_webrtc
2016/05/17 02:01:43
I don't think we should log this here. It should h
honghaiz3
2016/05/17 06:11:23
Done.
|
+ (unsigned long)[iceCandidates count]); |
tkchin_webrtc
2016/05/16 20:48:58
.count
honghaiz3
2016/05/17 00:46:53
Done.
|
+ for (RTCIceCandidate *iceCandidate in iceCandidates) { |
+ std::unique_ptr<const webrtc::IceCandidateInterface> candidate( |
+ iceCandidate.nativeCandidate); |
+ candidates.push_back(candidate->candidate()); |
tkchin_webrtc
2016/05/16 20:48:58
probably add a if (candidate) check since nativeCa
honghaiz3
2016/05/17 00:46:53
Done. Thanks!
|
+ // Need to fill the transport name from the sdp_mid. |
+ candidates.back().set_transport_name(candidate->sdp_mid()); |
+ } |
+ _peerConnection->RemoveIceCandidates(candidates); |
tkchin_webrtc
2016/05/16 20:48:58
ObjC name should match W3C name. Since this doesn'
honghaiz3
2016/05/17 00:46:53
C++ name style is capitalizing all words. RemoveIc
tkchin_webrtc
2016/05/17 02:01:43
I was referring to the name of the method. s/remov
honghaiz3
2016/05/17 06:11:23
Ah. I got it. You meant the method name in this cl
|
+} |
+ |
- (void)addStream:(RTCMediaStream *)stream { |
if (!_peerConnection->AddStream(stream.nativeMediaStream)) { |
RTCLogError(@"Failed to add stream: %@", stream); |