OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 if (!allocator) { | 256 if (!allocator) { |
257 allocator.reset(new cricket::BasicPortAllocator( | 257 allocator.reset(new cricket::BasicPortAllocator( |
258 default_network_manager_.get(), default_socket_factory_.get())); | 258 default_network_manager_.get(), default_socket_factory_.get())); |
259 } | 259 } |
260 network_thread_->Invoke<void>( | 260 network_thread_->Invoke<void>( |
261 RTC_FROM_HERE, rtc::Bind(&cricket::PortAllocator::SetNetworkIgnoreMask, | 261 RTC_FROM_HERE, rtc::Bind(&cricket::PortAllocator::SetNetworkIgnoreMask, |
262 allocator.get(), options_.network_ignore_mask)); | 262 allocator.get(), options_.network_ignore_mask)); |
263 | 263 |
264 std::unique_ptr<RtcEventLog> event_log = | 264 std::unique_ptr<RtcEventLog> event_log = |
265 event_log_factory_ ? event_log_factory_->CreateRtcEventLog() | 265 worker_thread_->Invoke<std::unique_ptr<RtcEventLog>>( |
266 : rtc::MakeUnique<RtcEventLogNullImpl>(); | 266 RTC_FROM_HERE, |
| 267 rtc::Bind(&PeerConnectionFactory::CreateRtcEventLog_w, this)); |
267 | 268 |
268 std::unique_ptr<Call> call = worker_thread_->Invoke<std::unique_ptr<Call>>( | 269 std::unique_ptr<Call> call = worker_thread_->Invoke<std::unique_ptr<Call>>( |
269 RTC_FROM_HERE, | 270 RTC_FROM_HERE, |
270 rtc::Bind(&PeerConnectionFactory::CreateCall_w, this, event_log.get())); | 271 rtc::Bind(&PeerConnectionFactory::CreateCall_w, this, event_log.get())); |
271 | 272 |
272 rtc::scoped_refptr<PeerConnection> pc( | 273 rtc::scoped_refptr<PeerConnection> pc( |
273 new rtc::RefCountedObject<PeerConnection>(this, std::move(event_log), | 274 new rtc::RefCountedObject<PeerConnection>(this, std::move(event_log), |
274 std::move(call))); | 275 std::move(call))); |
275 | 276 |
276 if (!pc->Initialize(configuration, std::move(allocator), | 277 if (!pc->Initialize(configuration, std::move(allocator), |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 325 } |
325 | 326 |
326 rtc::Thread* PeerConnectionFactory::worker_thread() { | 327 rtc::Thread* PeerConnectionFactory::worker_thread() { |
327 return worker_thread_; | 328 return worker_thread_; |
328 } | 329 } |
329 | 330 |
330 rtc::Thread* PeerConnectionFactory::network_thread() { | 331 rtc::Thread* PeerConnectionFactory::network_thread() { |
331 return network_thread_; | 332 return network_thread_; |
332 } | 333 } |
333 | 334 |
| 335 std::unique_ptr<RtcEventLog> PeerConnectionFactory::CreateRtcEventLog_w() { |
| 336 return event_log_factory_ ? event_log_factory_->CreateRtcEventLog() |
| 337 : rtc::MakeUnique<RtcEventLogNullImpl>(); |
| 338 } |
| 339 |
334 std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w( | 340 std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w( |
335 RtcEventLog* event_log) { | 341 RtcEventLog* event_log) { |
336 const int kMinBandwidthBps = 30000; | 342 const int kMinBandwidthBps = 30000; |
337 const int kStartBandwidthBps = 300000; | 343 const int kStartBandwidthBps = 300000; |
338 const int kMaxBandwidthBps = 2000000; | 344 const int kMaxBandwidthBps = 2000000; |
339 | 345 |
340 webrtc::Call::Config call_config(event_log); | 346 webrtc::Call::Config call_config(event_log); |
341 if (!channel_manager_->media_engine() || !call_factory_) { | 347 if (!channel_manager_->media_engine() || !call_factory_) { |
342 return nullptr; | 348 return nullptr; |
343 } | 349 } |
344 call_config.audio_state = channel_manager_->media_engine()->GetAudioState(); | 350 call_config.audio_state = channel_manager_->media_engine()->GetAudioState(); |
345 call_config.bitrate_config.min_bitrate_bps = kMinBandwidthBps; | 351 call_config.bitrate_config.min_bitrate_bps = kMinBandwidthBps; |
346 call_config.bitrate_config.start_bitrate_bps = kStartBandwidthBps; | 352 call_config.bitrate_config.start_bitrate_bps = kStartBandwidthBps; |
347 call_config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; | 353 call_config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; |
348 | 354 |
349 return std::unique_ptr<Call>(call_factory_->CreateCall(call_config)); | 355 return std::unique_ptr<Call>(call_factory_->CreateCall(call_config)); |
350 } | 356 } |
351 | 357 |
352 } // namespace webrtc | 358 } // namespace webrtc |
OLD | NEW |