OLD | NEW |
---|---|
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 rtc::scoped_refptr<webrtc::PeerConnectionInterface> _peerConnection; | 190 rtc::scoped_refptr<webrtc::PeerConnectionInterface> _peerConnection; |
191 } | 191 } |
192 | 192 |
193 @synthesize delegate = _delegate; | 193 @synthesize delegate = _delegate; |
194 | 194 |
195 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory | 195 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory |
196 configuration:(RTCConfiguration *)configuration | 196 configuration:(RTCConfiguration *)configuration |
197 constraints:(RTCMediaConstraints *)constraints | 197 constraints:(RTCMediaConstraints *)constraints |
198 delegate:(id<RTCPeerConnectionDelegate>)delegate { | 198 delegate:(id<RTCPeerConnectionDelegate>)delegate { |
199 NSParameterAssert(factory); | 199 NSParameterAssert(factory); |
200 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> config( | |
201 configuration.nativeConfiguration); | |
202 if (!config) | |
203 return nullptr; | |
tkchin_webrtc
2016/05/13 17:48:06
ObjC style requires braces
nil not nullptr.
if (
hbos
2016/05/16 12:49:05
Done.
| |
200 if (self = [super init]) { | 204 if (self = [super init]) { |
201 _observer.reset(new webrtc::PeerConnectionDelegateAdapter(self)); | 205 _observer.reset(new webrtc::PeerConnectionDelegateAdapter(self)); |
202 webrtc::PeerConnectionInterface::RTCConfiguration config = | |
203 configuration.nativeConfiguration; | |
204 std::unique_ptr<webrtc::MediaConstraints> nativeConstraints = | 206 std::unique_ptr<webrtc::MediaConstraints> nativeConstraints = |
205 constraints.nativeConstraints; | 207 constraints.nativeConstraints; |
206 _peerConnection = | 208 _peerConnection = |
207 factory.nativeFactory->CreatePeerConnection(config, | 209 factory.nativeFactory->CreatePeerConnection(*config, |
208 nativeConstraints.get(), | 210 nativeConstraints.get(), |
209 nullptr, | 211 nullptr, |
210 nullptr, | 212 nullptr, |
211 _observer.get()); | 213 _observer.get()); |
212 _localStreams = [[NSMutableArray alloc] init]; | 214 _localStreams = [[NSMutableArray alloc] init]; |
213 _delegate = delegate; | 215 _delegate = delegate; |
214 } | 216 } |
215 return self; | 217 return self; |
216 } | 218 } |
217 | 219 |
(...skipping 26 matching lines...) Expand all Loading... | |
244 return [[self class] iceConnectionStateForNativeState: | 246 return [[self class] iceConnectionStateForNativeState: |
245 _peerConnection->ice_connection_state()]; | 247 _peerConnection->ice_connection_state()]; |
246 } | 248 } |
247 | 249 |
248 - (RTCIceGatheringState)iceGatheringState { | 250 - (RTCIceGatheringState)iceGatheringState { |
249 return [[self class] iceGatheringStateForNativeState: | 251 return [[self class] iceGatheringStateForNativeState: |
250 _peerConnection->ice_gathering_state()]; | 252 _peerConnection->ice_gathering_state()]; |
251 } | 253 } |
252 | 254 |
253 - (BOOL)setConfiguration:(RTCConfiguration *)configuration { | 255 - (BOOL)setConfiguration:(RTCConfiguration *)configuration { |
254 return _peerConnection->SetConfiguration(configuration.nativeConfiguration); | 256 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> config( |
257 configuration.nativeConfiguration); | |
258 if (!config) | |
259 return false; | |
tkchin_webrtc
2016/05/13 17:48:06
BOOL is not a boolean
if (!nativeConfiguration) {
hbos
2016/05/16 12:49:05
Done.
| |
260 return _peerConnection->SetConfiguration(*config); | |
255 } | 261 } |
256 | 262 |
257 - (void)close { | 263 - (void)close { |
258 _peerConnection->Close(); | 264 _peerConnection->Close(); |
259 } | 265 } |
260 | 266 |
261 - (void)addIceCandidate:(RTCIceCandidate *)candidate { | 267 - (void)addIceCandidate:(RTCIceCandidate *)candidate { |
262 std::unique_ptr<const webrtc::IceCandidateInterface> iceCandidate( | 268 std::unique_ptr<const webrtc::IceCandidateInterface> iceCandidate( |
263 candidate.nativeCandidate); | 269 candidate.nativeCandidate); |
264 _peerConnection->AddIceCandidate(iceCandidate.get()); | 270 _peerConnection->AddIceCandidate(iceCandidate.get()); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 case RTCStatsOutputLevelDebug: | 505 case RTCStatsOutputLevelDebug: |
500 return webrtc::PeerConnectionInterface::kStatsOutputLevelDebug; | 506 return webrtc::PeerConnectionInterface::kStatsOutputLevelDebug; |
501 } | 507 } |
502 } | 508 } |
503 | 509 |
504 - (rtc::scoped_refptr<webrtc::PeerConnectionInterface>)nativePeerConnection { | 510 - (rtc::scoped_refptr<webrtc::PeerConnectionInterface>)nativePeerConnection { |
505 return _peerConnection; | 511 return _peerConnection; |
506 } | 512 } |
507 | 513 |
508 @end | 514 @end |
OLD | NEW |