Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Unified Diff: webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm

Issue 1972483002: Pass around the candidate removals events in IOS clients Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Merge with head Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 9a488fdf49423874d3b5e7c2b08a99d6e1fa7ef2..3fcc652e69b3d69b66c21d366e6223f4e787f6f7 100644
--- a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm
+++ b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm
@@ -25,6 +25,7 @@
#include <memory>
+#include "webrtc/api/jsepicecandidate.h"
#include "webrtc/base/checks.h"
NSString * const kRTCPeerConnectionErrorDomain =
@@ -182,6 +183,23 @@ void PeerConnectionDelegateAdapter::OnIceCandidate(
[peer_connection.delegate peerConnection:peer_connection
didGenerateIceCandidate:iceCandidate];
}
+
+void PeerConnectionDelegateAdapter::OnIceCandidatesRemoved(
+ const std::vector<cricket::Candidate>& candidates) {
+ NSMutableArray* ice_candidates =
+ [NSMutableArray arrayWithCapacity:candidates.size()];
+ for (const auto& candidate : candidates) {
+ std::unique_ptr<JsepIceCandidate> candidate_wrapper(
+ new JsepIceCandidate(candidate.transport_name(), -1, candidate));
+ RTCIceCandidate* ice_candidate = [[RTCIceCandidate alloc]
+ initWithNativeCandidate:candidate_wrapper.get()];
+ [ice_candidates addObject:ice_candidate];
+ }
+ RTCPeerConnection* peer_connection = peer_connection_;
+ [peer_connection.delegate peerConnection:peer_connection
+ didRemoveIceCandidates:ice_candidates];
+}
+
} // namespace webrtc
@@ -273,6 +291,22 @@ void PeerConnectionDelegateAdapter::OnIceCandidate(
_peerConnection->AddIceCandidate(iceCandidate.get());
}
+- (void)removeIceCandidates:(NSArray<RTCIceCandidate *> *)iceCandidates {
+ std::vector<cricket::Candidate> candidates;
+ for (RTCIceCandidate *iceCandidate in iceCandidates) {
+ std::unique_ptr<const webrtc::IceCandidateInterface> candidate(
+ iceCandidate.nativeCandidate);
+ if (candidate) {
+ candidates.push_back(candidate->candidate());
+ // Need to fill the transport name from the sdp_mid.
+ candidates.back().set_transport_name(candidate->sdp_mid());
+ }
+ }
+ if (!candidates.empty()) {
+ _peerConnection->RemoveIceCandidates(candidates);
+ }
+}
+
- (void)addStream:(RTCMediaStream *)stream {
if (!_peerConnection->AddStream(stream.nativeMediaStream)) {
RTCLogError(@"Failed to add stream: %@", stream);
« no previous file with comments | « webrtc/examples/objc/AppRTCDemo/RTCICECandidate+JSON.m ('k') | webrtc/sdk/objc/Framework/Classes/RTCPeerConnection+Private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698