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

Side by Side Diff: webrtc/api/objc/RTCPeerConnection.mm

Issue 1696673003: Tweaks for new Objective-C API. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Couple more tweaks after updating against master Created 4 years, 9 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
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory 193 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
194 configuration:(RTCConfiguration *)configuration 194 configuration:(RTCConfiguration *)configuration
195 constraints:(RTCMediaConstraints *)constraints 195 constraints:(RTCMediaConstraints *)constraints
196 delegate:(id<RTCPeerConnectionDelegate>)delegate { 196 delegate:(id<RTCPeerConnectionDelegate>)delegate {
197 NSParameterAssert(factory); 197 NSParameterAssert(factory);
198 if (self = [super init]) { 198 if (self = [super init]) {
199 _observer.reset(new webrtc::PeerConnectionDelegateAdapter(self)); 199 _observer.reset(new webrtc::PeerConnectionDelegateAdapter(self));
200 webrtc::PeerConnectionInterface::RTCConfiguration config = 200 webrtc::PeerConnectionInterface::RTCConfiguration config =
201 configuration.nativeConfiguration; 201 configuration.nativeConfiguration;
202 webrtc::MediaConstraints *nativeConstraints = 202 rtc::scoped_ptr<webrtc::MediaConstraints> nativeConstraints =
203 constraints.nativeConstraints.get(); 203 constraints.nativeConstraints;
204 _peerConnection = 204 _peerConnection =
205 factory.nativeFactory->CreatePeerConnection(config, 205 factory.nativeFactory->CreatePeerConnection(config,
206 nativeConstraints, 206 nativeConstraints.get(),
207 nullptr, 207 nullptr,
208 nullptr, 208 nullptr,
209 _observer.get()); 209 _observer.get());
210 _localStreams = [[NSMutableArray alloc] init]; 210 _localStreams = [[NSMutableArray alloc] init];
211 _delegate = delegate; 211 _delegate = delegate;
212 } 212 }
213 return self; 213 return self;
214 } 214 }
215 215
216 - (NSArray *)localStreams { 216 - (NSArray *)localStreams {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 _peerConnection->Close(); 252 _peerConnection->Close();
253 } 253 }
254 254
255 - (void)addIceCandidate:(RTCIceCandidate *)candidate { 255 - (void)addIceCandidate:(RTCIceCandidate *)candidate {
256 rtc::scoped_ptr<const webrtc::IceCandidateInterface> iceCandidate( 256 rtc::scoped_ptr<const webrtc::IceCandidateInterface> iceCandidate(
257 candidate.nativeCandidate); 257 candidate.nativeCandidate);
258 _peerConnection->AddIceCandidate(iceCandidate.get()); 258 _peerConnection->AddIceCandidate(iceCandidate.get());
259 } 259 }
260 260
261 - (void)addStream:(RTCMediaStream *)stream { 261 - (void)addStream:(RTCMediaStream *)stream {
262 if (_peerConnection->AddStream(stream.nativeMediaStream)) { 262 if (!_peerConnection->AddStream(stream.nativeMediaStream)) {
263 RTCLogError(@"Failed to add stream: %@", stream); 263 RTCLogError(@"Failed to add stream: %@", stream);
264 return; 264 return;
265 } 265 }
266 [_localStreams addObject:stream]; 266 [_localStreams addObject:stream];
267 } 267 }
268 268
269 - (void)removeStream:(RTCMediaStream *)stream { 269 - (void)removeStream:(RTCMediaStream *)stream {
270 _peerConnection->RemoveStream(stream.nativeMediaStream); 270 _peerConnection->RemoveStream(stream.nativeMediaStream);
271 [_localStreams removeObject:stream]; 271 [_localStreams removeObject:stream];
272 } 272 }
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 case RTCStatsOutputLevelDebug: 470 case RTCStatsOutputLevelDebug:
471 return webrtc::PeerConnectionInterface::kStatsOutputLevelDebug; 471 return webrtc::PeerConnectionInterface::kStatsOutputLevelDebug;
472 } 472 }
473 } 473 }
474 474
475 - (rtc::scoped_refptr<webrtc::PeerConnectionInterface>)nativePeerConnection { 475 - (rtc::scoped_refptr<webrtc::PeerConnectionInterface>)nativePeerConnection {
476 return _peerConnection; 476 return _peerConnection;
477 } 477 }
478 478
479 @end 479 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698