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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 return channel_manager_->StartAecDump(file); | 200 return channel_manager_->StartAecDump(file); |
201 } | 201 } |
202 | 202 |
203 rtc::scoped_refptr<PeerConnectionInterface> | 203 rtc::scoped_refptr<PeerConnectionInterface> |
204 PeerConnectionFactory::CreatePeerConnection( | 204 PeerConnectionFactory::CreatePeerConnection( |
205 const PeerConnectionInterface::RTCConfiguration& configuration, | 205 const PeerConnectionInterface::RTCConfiguration& configuration, |
206 const MediaConstraintsInterface* constraints, | 206 const MediaConstraintsInterface* constraints, |
207 PortAllocatorFactoryInterface* allocator_factory, | 207 PortAllocatorFactoryInterface* allocator_factory, |
208 DTLSIdentityServiceInterface* dtls_identity_service, | 208 DTLSIdentityServiceInterface* dtls_identity_service, |
209 PeerConnectionObserver* observer) { | 209 PeerConnectionObserver* observer) { |
210 DCHECK(signaling_thread_->IsCurrent()); | 210 PortAllocatorFactoryInterface* chosen_allocator_factory = |
211 DCHECK(allocator_factory || default_allocator_factory_); | 211 CreatePeerConnectionCommon(allocator_factory); |
212 | 212 |
213 if (!dtls_identity_service) { | 213 if (!dtls_identity_service) { |
214 dtls_identity_service = new DtlsIdentityService(dtls_identity_store_.get()); | 214 dtls_identity_service = new DtlsIdentityService(dtls_identity_store_.get()); |
215 } | 215 } |
216 | 216 |
| 217 rtc::scoped_refptr<PeerConnection> pc( |
| 218 new rtc::RefCountedObject<PeerConnection>(this)); |
| 219 // Note: |pc| takes ownership of |dtls_identity_service|. |
| 220 if (!pc->Initialize( |
| 221 configuration, |
| 222 constraints, |
| 223 chosen_allocator_factory, |
| 224 dtls_identity_service, |
| 225 observer)) { |
| 226 return nullptr; |
| 227 } |
| 228 return PeerConnectionProxy::Create(signaling_thread(), pc); |
| 229 } |
| 230 |
| 231 rtc::scoped_refptr<PeerConnectionInterface> |
| 232 PeerConnectionFactory::CreatePeerConnection( |
| 233 const PeerConnectionInterface::RTCConfiguration& configuration, |
| 234 const MediaConstraintsInterface* constraints, |
| 235 PortAllocatorFactoryInterface* allocator_factory, |
| 236 rtc::scoped_refptr<DtlsCertificate> certificate, |
| 237 PeerConnectionObserver* observer) { |
217 PortAllocatorFactoryInterface* chosen_allocator_factory = | 238 PortAllocatorFactoryInterface* chosen_allocator_factory = |
218 allocator_factory ? allocator_factory : default_allocator_factory_.get(); | 239 CreatePeerConnectionCommon(allocator_factory); |
219 chosen_allocator_factory->SetNetworkIgnoreMask(options_.network_ignore_mask); | |
220 | 240 |
221 rtc::scoped_refptr<PeerConnection> pc( | 241 rtc::scoped_refptr<PeerConnection> pc( |
222 new rtc::RefCountedObject<PeerConnection>(this)); | 242 new rtc::RefCountedObject<PeerConnection>(this)); |
223 if (!pc->Initialize( | 243 if (!pc->Initialize( |
224 configuration, | 244 configuration, |
225 constraints, | 245 constraints, |
226 chosen_allocator_factory, | 246 chosen_allocator_factory, |
227 dtls_identity_service, | 247 certificate, |
228 observer)) { | 248 observer)) { |
229 return NULL; | 249 return nullptr; |
230 } | 250 } |
231 return PeerConnectionProxy::Create(signaling_thread(), pc); | 251 return PeerConnectionProxy::Create(signaling_thread(), pc); |
232 } | 252 } |
233 | 253 |
| 254 PortAllocatorFactoryInterface* |
| 255 PeerConnectionFactory::CreatePeerConnectionCommon( |
| 256 PortAllocatorFactoryInterface* allocator_factory) { |
| 257 DCHECK(signaling_thread_->IsCurrent()); |
| 258 DCHECK(allocator_factory || default_allocator_factory_); |
| 259 |
| 260 PortAllocatorFactoryInterface* chosen_allocator_factory = |
| 261 allocator_factory ? allocator_factory : default_allocator_factory_.get(); |
| 262 chosen_allocator_factory->SetNetworkIgnoreMask(options_.network_ignore_mask); |
| 263 |
| 264 return chosen_allocator_factory; |
| 265 } |
| 266 |
234 rtc::scoped_refptr<MediaStreamInterface> | 267 rtc::scoped_refptr<MediaStreamInterface> |
235 PeerConnectionFactory::CreateLocalMediaStream(const std::string& label) { | 268 PeerConnectionFactory::CreateLocalMediaStream(const std::string& label) { |
236 DCHECK(signaling_thread_->IsCurrent()); | 269 DCHECK(signaling_thread_->IsCurrent()); |
237 return MediaStreamProxy::Create(signaling_thread_, | 270 return MediaStreamProxy::Create(signaling_thread_, |
238 MediaStream::Create(label)); | 271 MediaStream::Create(label)); |
239 } | 272 } |
240 | 273 |
241 rtc::scoped_refptr<VideoTrackInterface> | 274 rtc::scoped_refptr<VideoTrackInterface> |
242 PeerConnectionFactory::CreateVideoTrack( | 275 PeerConnectionFactory::CreateVideoTrack( |
243 const std::string& id, | 276 const std::string& id, |
(...skipping 30 matching lines...) Expand all Loading... |
274 } | 307 } |
275 | 308 |
276 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { | 309 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { |
277 ASSERT(worker_thread_ == rtc::Thread::Current()); | 310 ASSERT(worker_thread_ == rtc::Thread::Current()); |
278 return cricket::WebRtcMediaEngineFactory::Create( | 311 return cricket::WebRtcMediaEngineFactory::Create( |
279 default_adm_.get(), video_encoder_factory_.get(), | 312 default_adm_.get(), video_encoder_factory_.get(), |
280 video_decoder_factory_.get()); | 313 video_decoder_factory_.get()); |
281 } | 314 } |
282 | 315 |
283 } // namespace webrtc | 316 } // namespace webrtc |
OLD | NEW |