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

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

Issue 2854123003: Build WebRTC with data channel only. (Closed)
Patch Set: Revert the android changes. Created 3 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 kv.second.ice_restart = ice_restart; 385 kv.second.ice_restart = ice_restart;
386 } 386 }
387 387
388 if (!constraints) { 388 if (!constraints) {
389 return true; 389 return true;
390 } 390 }
391 return mandatory_constraints_satisfied == constraints->GetMandatory().size(); 391 return mandatory_constraints_satisfied == constraints->GetMandatory().size();
392 } 392 }
393 393
394 PeerConnection::PeerConnection(PeerConnectionFactory* factory) 394 PeerConnection::PeerConnection(PeerConnectionFactory* factory)
395 : PeerConnection(factory,
396 std::unique_ptr<RtcEventLog>(),
397 std::unique_ptr<Call>() /*Call*/) {}
398
399 PeerConnection::PeerConnection(PeerConnectionFactory* factory,
400 std::unique_ptr<RtcEventLog> event_log,
401 std::unique_ptr<Call> call)
395 : factory_(factory), 402 : factory_(factory),
396 observer_(NULL), 403 observer_(NULL),
397 uma_observer_(NULL), 404 uma_observer_(NULL),
398 event_log_(RtcEventLog::Create()), 405 event_log_(std::move(event_log)),
399 signaling_state_(kStable), 406 signaling_state_(kStable),
400 ice_connection_state_(kIceConnectionNew), 407 ice_connection_state_(kIceConnectionNew),
401 ice_gathering_state_(kIceGatheringNew), 408 ice_gathering_state_(kIceGatheringNew),
402 rtcp_cname_(GenerateRtcpCname()), 409 rtcp_cname_(GenerateRtcpCname()),
403 local_streams_(StreamCollection::Create()), 410 local_streams_(StreamCollection::Create()),
404 remote_streams_(StreamCollection::Create()) {} 411 remote_streams_(StreamCollection::Create()),
412 call_(std::move(call)) {}
405 413
406 PeerConnection::~PeerConnection() { 414 PeerConnection::~PeerConnection() {
407 TRACE_EVENT0("webrtc", "PeerConnection::~PeerConnection"); 415 TRACE_EVENT0("webrtc", "PeerConnection::~PeerConnection");
408 RTC_DCHECK(signaling_thread()->IsCurrent()); 416 RTC_DCHECK(signaling_thread()->IsCurrent());
409 // Need to detach RTP senders/receivers from WebRtcSession, 417 // Need to detach RTP senders/receivers from WebRtcSession,
410 // since it's about to be destroyed. 418 // since it's about to be destroyed.
411 for (const auto& sender : senders_) { 419 for (const auto& sender : senders_) {
412 sender->internal()->Stop(); 420 sender->internal()->Stop();
413 } 421 }
414 for (const auto& receiver : receivers_) { 422 for (const auto& receiver : receivers_) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 port_allocator_ = std::move(allocator); 461 port_allocator_ = std::move(allocator);
454 462
455 // The port allocator lives on the network thread and should be initialized 463 // The port allocator lives on the network thread and should be initialized
456 // there. 464 // there.
457 if (!network_thread()->Invoke<bool>( 465 if (!network_thread()->Invoke<bool>(
458 RTC_FROM_HERE, rtc::Bind(&PeerConnection::InitializePortAllocator_n, 466 RTC_FROM_HERE, rtc::Bind(&PeerConnection::InitializePortAllocator_n,
459 this, configuration))) { 467 this, configuration))) {
460 return false; 468 return false;
461 } 469 }
462 470
463 // Call must be constructed on the worker thread.
464 factory_->worker_thread()->Invoke<void>(
465 RTC_FROM_HERE, rtc::Bind(&PeerConnection::CreateCall_w,
466 this));
467 471
468 session_.reset(new WebRtcSession( 472 session_.reset(new WebRtcSession(
469 call_.get(), factory_->channel_manager(), configuration.media_config, 473 call_.get(), factory_->channel_manager(), configuration.media_config,
470 event_log_.get(), 474 event_log_.get(),
471 factory_->network_thread(), 475 factory_->network_thread(),
472 factory_->worker_thread(), factory_->signaling_thread(), 476 factory_->worker_thread(), factory_->signaling_thread(),
473 port_allocator_.get(), 477 port_allocator_.get(),
474 std::unique_ptr<cricket::TransportController>( 478 std::unique_ptr<cricket::TransportController>(
475 factory_->CreateTransportController( 479 factory_->CreateTransportController(
476 port_allocator_.get(), 480 port_allocator_.get(),
(...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after
2368 } 2372 }
2369 return event_log_->StartLogging(file, max_size_bytes); 2373 return event_log_->StartLogging(file, max_size_bytes);
2370 } 2374 }
2371 2375
2372 void PeerConnection::StopRtcEventLog_w() { 2376 void PeerConnection::StopRtcEventLog_w() {
2373 if (event_log_) { 2377 if (event_log_) {
2374 event_log_->StopLogging(); 2378 event_log_->StopLogging();
2375 } 2379 }
2376 } 2380 }
2377 2381
2378 void PeerConnection::CreateCall_w() {
2379 RTC_DCHECK(!call_);
2380
2381 const int kMinBandwidthBps = 30000;
2382 const int kStartBandwidthBps = 300000;
2383 const int kMaxBandwidthBps = 2000000;
2384
2385 webrtc::Call::Config call_config(event_log_.get());
2386 call_config.audio_state =
2387 factory_->channel_manager() ->media_engine()->GetAudioState();
2388 call_config.bitrate_config.min_bitrate_bps = kMinBandwidthBps;
2389 call_config.bitrate_config.start_bitrate_bps = kStartBandwidthBps;
2390 call_config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps;
2391
2392 call_.reset(webrtc::Call::Create(call_config));
2393 }
2394
2395 } // namespace webrtc 2382 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698