Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2004--2011 Google Inc. | 3 * Copyright 2004--2011 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 DCHECK(signaling_thread_->IsCurrent()); | 220 DCHECK(signaling_thread_->IsCurrent()); |
| 221 return channel_manager_->StartAecDump(file); | 221 return channel_manager_->StartAecDump(file); |
| 222 } | 222 } |
| 223 | 223 |
| 224 rtc::scoped_refptr<PeerConnectionInterface> | 224 rtc::scoped_refptr<PeerConnectionInterface> |
| 225 PeerConnectionFactory::CreatePeerConnection( | 225 PeerConnectionFactory::CreatePeerConnection( |
| 226 const PeerConnectionInterface::RTCConfiguration& configuration, | 226 const PeerConnectionInterface::RTCConfiguration& configuration, |
| 227 const MediaConstraintsInterface* constraints, | 227 const MediaConstraintsInterface* constraints, |
| 228 PortAllocatorFactoryInterface* allocator_factory, | 228 PortAllocatorFactoryInterface* allocator_factory, |
| 229 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, | 229 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
| 230 PeerConnectionObserver* observer) { | 230 PeerConnectionObserver* observer) { |
|
Henrik Grunell WebRTC
2015/08/12 14:46:29
Keep the dchecks here as well. And in the new func
hbos
2015/08/14 14:09:38
Done.
| |
| 231 DCHECK(signaling_thread_->IsCurrent()); | 231 PortAllocatorFactoryInterface* chosen_allocator_factory = |
| 232 DCHECK(allocator_factory || default_allocator_factory_); | 232 CreatePeerConnectionCommon(allocator_factory); |
| 233 | 233 |
| 234 if (!dtls_identity_store.get()) { | 234 if (!dtls_identity_store.get()) { |
| 235 // Because |pc|->Initialize takes ownership of the store we need a new | 235 // Because |pc|->Initialize takes ownership of the store in Pass()ing we |
| 236 // wrapper object that can be deleted without deleting the underlying | 236 // need a new wrapper object that can be passed and eventually deleted |
| 237 // |dtls_identity_store_|, protecting it from being deleted multiple times. | 237 // without passing and deleting our |dtls_identity_store_|. |
| 238 dtls_identity_store.reset( | 238 dtls_identity_store.reset( |
| 239 new DtlsIdentityStoreWrapper(dtls_identity_store_)); | 239 new DtlsIdentityStoreWrapper(dtls_identity_store_)); |
| 240 } | 240 } |
| 241 | 241 |
| 242 rtc::scoped_refptr<PeerConnection> pc( | |
| 243 new rtc::RefCountedObject<PeerConnection>(this)); | |
| 244 if (!pc->Initialize( | |
| 245 configuration, | |
| 246 constraints, | |
| 247 chosen_allocator_factory, | |
| 248 dtls_identity_store.Pass(), | |
| 249 observer)) { | |
| 250 return nullptr; | |
| 251 } | |
| 252 return PeerConnectionProxy::Create(signaling_thread(), pc); | |
| 253 } | |
| 254 | |
| 255 rtc::scoped_refptr<PeerConnectionInterface> | |
| 256 PeerConnectionFactory::CreatePeerConnection( | |
| 257 const PeerConnectionInterface::RTCConfiguration& configuration, | |
| 258 const MediaConstraintsInterface* constraints, | |
| 259 PortAllocatorFactoryInterface* allocator_factory, | |
| 260 const rtc::scoped_refptr<DtlsCertificate>& certificate, | |
| 261 PeerConnectionObserver* observer) { | |
| 242 PortAllocatorFactoryInterface* chosen_allocator_factory = | 262 PortAllocatorFactoryInterface* chosen_allocator_factory = |
| 243 allocator_factory ? allocator_factory : default_allocator_factory_.get(); | 263 CreatePeerConnectionCommon(allocator_factory); |
| 244 chosen_allocator_factory->SetNetworkIgnoreMask(options_.network_ignore_mask); | |
| 245 | 264 |
| 246 rtc::scoped_refptr<PeerConnection> pc( | 265 rtc::scoped_refptr<PeerConnection> pc( |
| 247 new rtc::RefCountedObject<PeerConnection>(this)); | 266 new rtc::RefCountedObject<PeerConnection>(this)); |
| 248 if (!pc->Initialize( | 267 if (!pc->Initialize( |
| 249 configuration, | 268 configuration, |
| 250 constraints, | 269 constraints, |
| 251 chosen_allocator_factory, | 270 chosen_allocator_factory, |
| 252 dtls_identity_store.Pass(), | 271 certificate, |
| 253 observer)) { | 272 observer)) { |
| 254 return NULL; | 273 return nullptr; |
| 255 } | 274 } |
| 256 return PeerConnectionProxy::Create(signaling_thread(), pc); | 275 return PeerConnectionProxy::Create(signaling_thread(), pc); |
| 257 } | 276 } |
| 258 | 277 |
| 278 PortAllocatorFactoryInterface* | |
| 279 PeerConnectionFactory::CreatePeerConnectionCommon( | |
|
Henrik Grunell WebRTC
2015/08/12 14:46:29
This function should be called something so one kn
hbos
2015/08/14 14:09:39
Done.
| |
| 280 PortAllocatorFactoryInterface* allocator_factory) { | |
| 281 DCHECK(signaling_thread_->IsCurrent()); | |
| 282 DCHECK(allocator_factory || default_allocator_factory_); | |
| 283 | |
| 284 PortAllocatorFactoryInterface* chosen_allocator_factory = | |
| 285 allocator_factory ? allocator_factory : default_allocator_factory_.get(); | |
| 286 chosen_allocator_factory->SetNetworkIgnoreMask(options_.network_ignore_mask); | |
| 287 | |
| 288 return chosen_allocator_factory; | |
| 289 } | |
| 290 | |
| 259 rtc::scoped_refptr<MediaStreamInterface> | 291 rtc::scoped_refptr<MediaStreamInterface> |
| 260 PeerConnectionFactory::CreateLocalMediaStream(const std::string& label) { | 292 PeerConnectionFactory::CreateLocalMediaStream(const std::string& label) { |
| 261 DCHECK(signaling_thread_->IsCurrent()); | 293 DCHECK(signaling_thread_->IsCurrent()); |
| 262 return MediaStreamProxy::Create(signaling_thread_, | 294 return MediaStreamProxy::Create(signaling_thread_, |
| 263 MediaStream::Create(label)); | 295 MediaStream::Create(label)); |
| 264 } | 296 } |
| 265 | 297 |
| 266 rtc::scoped_refptr<VideoTrackInterface> | 298 rtc::scoped_refptr<VideoTrackInterface> |
| 267 PeerConnectionFactory::CreateVideoTrack( | 299 PeerConnectionFactory::CreateVideoTrack( |
| 268 const std::string& id, | 300 const std::string& id, |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 299 } | 331 } |
| 300 | 332 |
| 301 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { | 333 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { |
| 302 ASSERT(worker_thread_ == rtc::Thread::Current()); | 334 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 303 return cricket::WebRtcMediaEngineFactory::Create( | 335 return cricket::WebRtcMediaEngineFactory::Create( |
| 304 default_adm_.get(), video_encoder_factory_.get(), | 336 default_adm_.get(), video_encoder_factory_.get(), |
| 305 video_decoder_factory_.get()); | 337 video_decoder_factory_.get()); |
| 306 } | 338 } |
| 307 | 339 |
| 308 } // namespace webrtc | 340 } // namespace webrtc |
| OLD | NEW |