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

Side by Side Diff: webrtc/pc/peerconnectionfactory.cc

Issue 3005153002: Reland of Make RtcEventLogImpl to use a TaskQueue instead of a helper-thread (Closed)
Patch Set: RtcEventLog created on same thread as it's destroyed. Created 3 years, 3 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/pc/peerconnectionfactory.h ('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 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
11 #include "webrtc/pc/peerconnectionfactory.h" 11 #include "webrtc/pc/peerconnectionfactory.h"
12 12
13 #include <utility> 13 #include <utility>
14 14
15 #include "webrtc/api/mediaconstraintsinterface.h" 15 #include "webrtc/api/mediaconstraintsinterface.h"
16 #include "webrtc/api/mediastreamproxy.h" 16 #include "webrtc/api/mediastreamproxy.h"
17 #include "webrtc/api/mediastreamtrackproxy.h" 17 #include "webrtc/api/mediastreamtrackproxy.h"
18 #include "webrtc/api/peerconnectionfactoryproxy.h" 18 #include "webrtc/api/peerconnectionfactoryproxy.h"
19 #include "webrtc/api/peerconnectionproxy.h" 19 #include "webrtc/api/peerconnectionproxy.h"
20 #include "webrtc/api/videosourceproxy.h" 20 #include "webrtc/api/videosourceproxy.h"
21 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 21 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
22 #include "webrtc/rtc_base/bind.h" 22 #include "webrtc/rtc_base/bind.h"
23 #include "webrtc/rtc_base/checks.h" 23 #include "webrtc/rtc_base/checks.h"
24 #include "webrtc/rtc_base/ptr_util.h"
25 // Adding 'nogncheck' to disable the gn include headers check to support modular 24 // Adding 'nogncheck' to disable the gn include headers check to support modular
26 // WebRTC build targets. 25 // WebRTC build targets.
27 // TODO(zhihuang): This wouldn't be necessary if the interface and 26 // TODO(zhihuang): This wouldn't be necessary if the interface and
28 // implementation of the media engine were in separate build targets. 27 // implementation of the media engine were in separate build targets.
29 #include "webrtc/media/engine/webrtcmediaengine.h" // nogncheck 28 #include "webrtc/media/engine/webrtcmediaengine.h" // nogncheck
30 #include "webrtc/media/engine/webrtcvideodecoderfactory.h" // nogncheck 29 #include "webrtc/media/engine/webrtcvideodecoderfactory.h" // nogncheck
31 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" // nogncheck 30 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" // nogncheck
32 #include "webrtc/modules/audio_device/include/audio_device.h" // nogncheck 31 #include "webrtc/modules/audio_device/include/audio_device.h" // nogncheck
33 #include "webrtc/p2p/base/basicpacketsocketfactory.h" 32 #include "webrtc/p2p/base/basicpacketsocketfactory.h"
34 #include "webrtc/p2p/client/basicportallocator.h" 33 #include "webrtc/p2p/client/basicportallocator.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 253 }
255 254
256 if (!allocator) { 255 if (!allocator) {
257 allocator.reset(new cricket::BasicPortAllocator( 256 allocator.reset(new cricket::BasicPortAllocator(
258 default_network_manager_.get(), default_socket_factory_.get())); 257 default_network_manager_.get(), default_socket_factory_.get()));
259 } 258 }
260 network_thread_->Invoke<void>( 259 network_thread_->Invoke<void>(
261 RTC_FROM_HERE, rtc::Bind(&cricket::PortAllocator::SetNetworkIgnoreMask, 260 RTC_FROM_HERE, rtc::Bind(&cricket::PortAllocator::SetNetworkIgnoreMask,
262 allocator.get(), options_.network_ignore_mask)); 261 allocator.get(), options_.network_ignore_mask));
263 262
264 std::unique_ptr<RtcEventLog> event_log = 263 std::unique_ptr<RtcEventLog> event_log =
eladalon 2017/09/05 13:04:32 There's a trade-off between Invoke()-ing twice (bl
265 event_log_factory_ ? event_log_factory_->CreateRtcEventLog() 264 worker_thread_->Invoke<std::unique_ptr<RtcEventLog>>(
266 : rtc::MakeUnique<RtcEventLogNullImpl>(); 265 RTC_FROM_HERE,
266 rtc::Bind(&PeerConnectionFactory::CreateRtcEventLog_w, this));
267 267
268 std::unique_ptr<Call> call = worker_thread_->Invoke<std::unique_ptr<Call>>( 268 std::unique_ptr<Call> call = worker_thread_->Invoke<std::unique_ptr<Call>>(
269 RTC_FROM_HERE, 269 RTC_FROM_HERE,
270 rtc::Bind(&PeerConnectionFactory::CreateCall_w, this, event_log.get())); 270 rtc::Bind(&PeerConnectionFactory::CreateCall_w, this, event_log.get()));
271 271
272 rtc::scoped_refptr<PeerConnection> pc( 272 rtc::scoped_refptr<PeerConnection> pc(
273 new rtc::RefCountedObject<PeerConnection>(this, std::move(event_log), 273 new rtc::RefCountedObject<PeerConnection>(this, std::move(event_log),
274 std::move(call))); 274 std::move(call)));
275 275
276 if (!pc->Initialize(configuration, std::move(allocator), 276 if (!pc->Initialize(configuration, std::move(allocator),
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 } 324 }
325 325
326 rtc::Thread* PeerConnectionFactory::worker_thread() { 326 rtc::Thread* PeerConnectionFactory::worker_thread() {
327 return worker_thread_; 327 return worker_thread_;
328 } 328 }
329 329
330 rtc::Thread* PeerConnectionFactory::network_thread() { 330 rtc::Thread* PeerConnectionFactory::network_thread() {
331 return network_thread_; 331 return network_thread_;
332 } 332 }
333 333
334 std::unique_ptr<RtcEventLog> PeerConnectionFactory::CreateRtcEventLog_w() {
335 return event_log_factory_ ? event_log_factory_->CreateRtcEventLog()
336 : rtc::MakeUnique<RtcEventLogNullImpl>();
337 }
338
334 std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w( 339 std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w(
335 RtcEventLog* event_log) { 340 RtcEventLog* event_log) {
336 const int kMinBandwidthBps = 30000; 341 const int kMinBandwidthBps = 30000;
337 const int kStartBandwidthBps = 300000; 342 const int kStartBandwidthBps = 300000;
338 const int kMaxBandwidthBps = 2000000; 343 const int kMaxBandwidthBps = 2000000;
339 344
340 webrtc::Call::Config call_config(event_log); 345 webrtc::Call::Config call_config(event_log);
341 if (!channel_manager_->media_engine() || !call_factory_) { 346 if (!channel_manager_->media_engine() || !call_factory_) {
342 return nullptr; 347 return nullptr;
343 } 348 }
344 call_config.audio_state = channel_manager_->media_engine()->GetAudioState(); 349 call_config.audio_state = channel_manager_->media_engine()->GetAudioState();
345 call_config.bitrate_config.min_bitrate_bps = kMinBandwidthBps; 350 call_config.bitrate_config.min_bitrate_bps = kMinBandwidthBps;
346 call_config.bitrate_config.start_bitrate_bps = kStartBandwidthBps; 351 call_config.bitrate_config.start_bitrate_bps = kStartBandwidthBps;
347 call_config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; 352 call_config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps;
348 353
349 return std::unique_ptr<Call>(call_factory_->CreateCall(call_config)); 354 return std::unique_ptr<Call>(call_factory_->CreateCall(call_config));
350 } 355 }
351 356
352 } // namespace webrtc 357 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/pc/peerconnectionfactory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698