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

Side by Side 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: Fix a type conversion in RTCPeerConnection.mm 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #import "RTCPeerConnection+Private.h" 11 #import "RTCPeerConnection+Private.h"
12 12
13 #import "NSString+StdString.h" 13 #import "NSString+StdString.h"
14 #import "RTCConfiguration+Private.h" 14 #import "RTCConfiguration+Private.h"
15 #import "RTCDataChannel+Private.h" 15 #import "RTCDataChannel+Private.h"
16 #import "RTCIceCandidate+Private.h" 16 #import "RTCIceCandidate+Private.h"
17 #import "RTCMediaConstraints+Private.h" 17 #import "RTCMediaConstraints+Private.h"
18 #import "RTCMediaStream+Private.h" 18 #import "RTCMediaStream+Private.h"
19 #import "RTCPeerConnectionFactory+Private.h" 19 #import "RTCPeerConnectionFactory+Private.h"
20 #import "RTCRtpSender+Private.h" 20 #import "RTCRtpSender+Private.h"
21 #import "RTCSessionDescription+Private.h" 21 #import "RTCSessionDescription+Private.h"
22 #import "RTCStatsReport+Private.h" 22 #import "RTCStatsReport+Private.h"
23 #import "WebRTC/RTCLogging.h" 23 #import "WebRTC/RTCLogging.h"
24 24
25 #include <memory> 25 #include <memory>
26 26
27 #include "webrtc/api/jsepicecandidate.h"
27 #include "webrtc/base/checks.h" 28 #include "webrtc/base/checks.h"
28 29
29 NSString * const kRTCPeerConnectionErrorDomain = 30 NSString * const kRTCPeerConnectionErrorDomain =
30 @"org.webrtc.RTCPeerConnection"; 31 @"org.webrtc.RTCPeerConnection";
31 int const kRTCPeerConnnectionSessionDescriptionError = -1; 32 int const kRTCPeerConnnectionSessionDescriptionError = -1;
32 33
33 namespace webrtc { 34 namespace webrtc {
34 35
35 class CreateSessionDescriptionObserverAdapter 36 class CreateSessionDescriptionObserverAdapter
36 : public CreateSessionDescriptionObserver { 37 : public CreateSessionDescriptionObserver {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 175 }
175 176
176 void PeerConnectionDelegateAdapter::OnIceCandidate( 177 void PeerConnectionDelegateAdapter::OnIceCandidate(
177 const IceCandidateInterface *candidate) { 178 const IceCandidateInterface *candidate) {
178 RTCIceCandidate *iceCandidate = 179 RTCIceCandidate *iceCandidate =
179 [[RTCIceCandidate alloc] initWithNativeCandidate:candidate]; 180 [[RTCIceCandidate alloc] initWithNativeCandidate:candidate];
180 RTCPeerConnection *peer_connection = peer_connection_; 181 RTCPeerConnection *peer_connection = peer_connection_;
181 [peer_connection.delegate peerConnection:peer_connection 182 [peer_connection.delegate peerConnection:peer_connection
182 didGenerateIceCandidate:iceCandidate]; 183 didGenerateIceCandidate:iceCandidate];
183 } 184 }
185
186 void PeerConnectionDelegateAdapter::OnIceCandidatesRemoved(
187 const std::vector<cricket::Candidate>& candidates) {
188 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.
189 [NSMutableArray arrayWithCapacity:candidates.size()];
190 for (const auto& candidate : candidates) {
191 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
192 new JsepIceCandidate(candidate.transport_name(), -1, candidate));
193 RTCIceCandidate* iceCandidate = [[RTCIceCandidate alloc]
194 initWithNativeCandidate:candidate_wrapper.get()];
195 [iceCandidates addObject:iceCandidate];
196 }
197 RTCPeerConnection* peer_connection = peer_connection_;
198 [peer_connection.delegate peerConnection:peer_connection
199 didRemoveIceCandidates:iceCandidates];
200 }
201
184 } // namespace webrtc 202 } // namespace webrtc
185 203
186 204
187 @implementation RTCPeerConnection { 205 @implementation RTCPeerConnection {
188 NSMutableArray *_localStreams; 206 NSMutableArray *_localStreams;
189 std::unique_ptr<webrtc::PeerConnectionDelegateAdapter> _observer; 207 std::unique_ptr<webrtc::PeerConnectionDelegateAdapter> _observer;
190 rtc::scoped_refptr<webrtc::PeerConnectionInterface> _peerConnection; 208 rtc::scoped_refptr<webrtc::PeerConnectionInterface> _peerConnection;
191 } 209 }
192 210
193 @synthesize delegate = _delegate; 211 @synthesize delegate = _delegate;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 - (void)close { 275 - (void)close {
258 _peerConnection->Close(); 276 _peerConnection->Close();
259 } 277 }
260 278
261 - (void)addIceCandidate:(RTCIceCandidate *)candidate { 279 - (void)addIceCandidate:(RTCIceCandidate *)candidate {
262 std::unique_ptr<const webrtc::IceCandidateInterface> iceCandidate( 280 std::unique_ptr<const webrtc::IceCandidateInterface> iceCandidate(
263 candidate.nativeCandidate); 281 candidate.nativeCandidate);
264 _peerConnection->AddIceCandidate(iceCandidate.get()); 282 _peerConnection->AddIceCandidate(iceCandidate.get());
265 } 283 }
266 284
285 - (void)removeRemoteIceCandidates:(NSArray<RTCIceCandidate *> *)iceCandidates {
286 std::vector<cricket::Candidate> candidates;
287 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.
288 (unsigned long)[iceCandidates count]);
tkchin_webrtc 2016/05/16 20:48:58 .count
honghaiz3 2016/05/17 00:46:53 Done.
289 for (RTCIceCandidate *iceCandidate in iceCandidates) {
290 std::unique_ptr<const webrtc::IceCandidateInterface> candidate(
291 iceCandidate.nativeCandidate);
292 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!
293 // Need to fill the transport name from the sdp_mid.
294 candidates.back().set_transport_name(candidate->sdp_mid());
295 }
296 _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
297 }
298
267 - (void)addStream:(RTCMediaStream *)stream { 299 - (void)addStream:(RTCMediaStream *)stream {
268 if (!_peerConnection->AddStream(stream.nativeMediaStream)) { 300 if (!_peerConnection->AddStream(stream.nativeMediaStream)) {
269 RTCLogError(@"Failed to add stream: %@", stream); 301 RTCLogError(@"Failed to add stream: %@", stream);
270 return; 302 return;
271 } 303 }
272 [_localStreams addObject:stream]; 304 [_localStreams addObject:stream];
273 } 305 }
274 306
275 - (void)removeStream:(RTCMediaStream *)stream { 307 - (void)removeStream:(RTCMediaStream *)stream {
276 _peerConnection->RemoveStream(stream.nativeMediaStream); 308 _peerConnection->RemoveStream(stream.nativeMediaStream);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 case RTCStatsOutputLevelDebug: 531 case RTCStatsOutputLevelDebug:
500 return webrtc::PeerConnectionInterface::kStatsOutputLevelDebug; 532 return webrtc::PeerConnectionInterface::kStatsOutputLevelDebug;
501 } 533 }
502 } 534 }
503 535
504 - (rtc::scoped_refptr<webrtc::PeerConnectionInterface>)nativePeerConnection { 536 - (rtc::scoped_refptr<webrtc::PeerConnectionInterface>)nativePeerConnection {
505 return _peerConnection; 537 return _peerConnection;
506 } 538 }
507 539
508 @end 540 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698