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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm

Issue 2603653002: Merge RTCConfiguration with RTCMediaConstraints in Java/Obj-C wrappers. (Closed)
Patch Set: . Created 3 years, 12 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
« no previous file with comments | « webrtc/sdk/android/src/jni/peerconnection_jni.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 didRemoveIceCandidates:ice_candidates]; 200 didRemoveIceCandidates:ice_candidates];
201 } 201 }
202 202
203 } // namespace webrtc 203 } // namespace webrtc
204 204
205 205
206 @implementation RTCPeerConnection { 206 @implementation RTCPeerConnection {
207 NSMutableArray<RTCMediaStream *> *_localStreams; 207 NSMutableArray<RTCMediaStream *> *_localStreams;
208 std::unique_ptr<webrtc::PeerConnectionDelegateAdapter> _observer; 208 std::unique_ptr<webrtc::PeerConnectionDelegateAdapter> _observer;
209 rtc::scoped_refptr<webrtc::PeerConnectionInterface> _peerConnection; 209 rtc::scoped_refptr<webrtc::PeerConnectionInterface> _peerConnection;
210 std::unique_ptr<webrtc::MediaConstraints> _nativeConstraints;
tkchin_webrtc 2017/01/09 21:56:36 Is this safe? Does peerconnection take ownership o
Taylor Brandstetter 2017/01/09 22:03:45 Yes, it's safe, and n,o nothing else takes ownersh
tkchin_webrtc 2017/01/09 22:35:30 Ah, so it is. Thanks.
210 BOOL _hasStartedRtcEventLog; 211 BOOL _hasStartedRtcEventLog;
211 } 212 }
212 213
213 @synthesize delegate = _delegate; 214 @synthesize delegate = _delegate;
214 215
215 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory 216 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
216 configuration:(RTCConfiguration *)configuration 217 configuration:(RTCConfiguration *)configuration
217 constraints:(RTCMediaConstraints *)constraints 218 constraints:(RTCMediaConstraints *)constraints
218 delegate:(id<RTCPeerConnectionDelegate>)delegate { 219 delegate:(id<RTCPeerConnectionDelegate>)delegate {
219 NSParameterAssert(factory); 220 NSParameterAssert(factory);
220 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> config( 221 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> config(
221 [configuration createNativeConfiguration]); 222 [configuration createNativeConfiguration]);
222 if (!config) { 223 if (!config) {
223 return nil; 224 return nil;
224 } 225 }
225 if (self = [super init]) { 226 if (self = [super init]) {
226 _observer.reset(new webrtc::PeerConnectionDelegateAdapter(self)); 227 _observer.reset(new webrtc::PeerConnectionDelegateAdapter(self));
227 std::unique_ptr<webrtc::MediaConstraints> nativeConstraints = 228 _nativeConstraints = constraints.nativeConstraints;
228 constraints.nativeConstraints; 229 CopyConstraintsIntoRtcConfiguration(_nativeConstraints.get(),
230 config.get());
229 _peerConnection = 231 _peerConnection =
230 factory.nativeFactory->CreatePeerConnection(*config, 232 factory.nativeFactory->CreatePeerConnection(*config,
231 nativeConstraints.get(),
232 nullptr, 233 nullptr,
233 nullptr, 234 nullptr,
234 _observer.get()); 235 _observer.get());
235 if (!_peerConnection) { 236 if (!_peerConnection) {
236 return nil; 237 return nil;
237 } 238 }
238 _localStreams = [[NSMutableArray alloc] init]; 239 _localStreams = [[NSMutableArray alloc] init];
239 _delegate = delegate; 240 _delegate = delegate;
240 } 241 }
241 return self; 242 return self;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 return [[self class] iceGatheringStateForNativeState: 276 return [[self class] iceGatheringStateForNativeState:
276 _peerConnection->ice_gathering_state()]; 277 _peerConnection->ice_gathering_state()];
277 } 278 }
278 279
279 - (BOOL)setConfiguration:(RTCConfiguration *)configuration { 280 - (BOOL)setConfiguration:(RTCConfiguration *)configuration {
280 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> config( 281 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> config(
281 [configuration createNativeConfiguration]); 282 [configuration createNativeConfiguration]);
282 if (!config) { 283 if (!config) {
283 return NO; 284 return NO;
284 } 285 }
286 CopyConstraintsIntoRtcConfiguration(_nativeConstraints.get(),
287 config.get());
285 return _peerConnection->SetConfiguration(*config); 288 return _peerConnection->SetConfiguration(*config);
286 } 289 }
287 290
288 - (void)close { 291 - (void)close {
289 _peerConnection->Close(); 292 _peerConnection->Close();
290 } 293 }
291 294
292 - (void)addIceCandidate:(RTCIceCandidate *)candidate { 295 - (void)addIceCandidate:(RTCIceCandidate *)candidate {
293 std::unique_ptr<const webrtc::IceCandidateInterface> iceCandidate( 296 std::unique_ptr<const webrtc::IceCandidateInterface> iceCandidate(
294 candidate.nativeCandidate); 297 candidate.nativeCandidate);
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 case RTCStatsOutputLevelDebug: 586 case RTCStatsOutputLevelDebug:
584 return webrtc::PeerConnectionInterface::kStatsOutputLevelDebug; 587 return webrtc::PeerConnectionInterface::kStatsOutputLevelDebug;
585 } 588 }
586 } 589 }
587 590
588 - (rtc::scoped_refptr<webrtc::PeerConnectionInterface>)nativePeerConnection { 591 - (rtc::scoped_refptr<webrtc::PeerConnectionInterface>)nativePeerConnection {
589 return _peerConnection; 592 return _peerConnection;
590 } 593 }
591 594
592 @end 595 @end
OLDNEW
« no previous file with comments | « webrtc/sdk/android/src/jni/peerconnection_jni.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698