OLD | NEW |
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 19 matching lines...) Expand all Loading... |
30 #include "webrtc/api/streamcollection.h" | 30 #include "webrtc/api/streamcollection.h" |
31 #include "webrtc/api/videocapturertracksource.h" | 31 #include "webrtc/api/videocapturertracksource.h" |
32 #include "webrtc/api/videotrack.h" | 32 #include "webrtc/api/videotrack.h" |
33 #include "webrtc/base/arraysize.h" | 33 #include "webrtc/base/arraysize.h" |
34 #include "webrtc/base/bind.h" | 34 #include "webrtc/base/bind.h" |
35 #include "webrtc/base/logging.h" | 35 #include "webrtc/base/logging.h" |
36 #include "webrtc/base/stringencode.h" | 36 #include "webrtc/base/stringencode.h" |
37 #include "webrtc/base/stringutils.h" | 37 #include "webrtc/base/stringutils.h" |
38 #include "webrtc/base/trace_event.h" | 38 #include "webrtc/base/trace_event.h" |
39 #include "webrtc/call.h" | 39 #include "webrtc/call.h" |
| 40 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
40 #include "webrtc/media/sctp/sctpdataengine.h" | 41 #include "webrtc/media/sctp/sctpdataengine.h" |
41 #include "webrtc/pc/channelmanager.h" | 42 #include "webrtc/pc/channelmanager.h" |
| 43 #include "webrtc/system_wrappers/include/clock.h" |
42 #include "webrtc/system_wrappers/include/field_trial.h" | 44 #include "webrtc/system_wrappers/include/field_trial.h" |
43 | 45 |
44 namespace { | 46 namespace { |
45 | 47 |
46 using webrtc::DataChannel; | 48 using webrtc::DataChannel; |
47 using webrtc::MediaConstraintsInterface; | 49 using webrtc::MediaConstraintsInterface; |
48 using webrtc::MediaStreamInterface; | 50 using webrtc::MediaStreamInterface; |
49 using webrtc::PeerConnectionInterface; | 51 using webrtc::PeerConnectionInterface; |
50 using webrtc::RtpSenderInternal; | 52 using webrtc::RtpSenderInternal; |
51 using webrtc::RtpSenderInterface; | 53 using webrtc::RtpSenderInterface; |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 } | 566 } |
565 | 567 |
566 PeerConnection::PeerConnection(PeerConnectionFactory* factory) | 568 PeerConnection::PeerConnection(PeerConnectionFactory* factory) |
567 : factory_(factory), | 569 : factory_(factory), |
568 observer_(NULL), | 570 observer_(NULL), |
569 uma_observer_(NULL), | 571 uma_observer_(NULL), |
570 signaling_state_(kStable), | 572 signaling_state_(kStable), |
571 ice_state_(kIceNew), | 573 ice_state_(kIceNew), |
572 ice_connection_state_(kIceConnectionNew), | 574 ice_connection_state_(kIceConnectionNew), |
573 ice_gathering_state_(kIceGatheringNew), | 575 ice_gathering_state_(kIceGatheringNew), |
| 576 event_log_(RtcEventLog::Create(webrtc::Clock::GetRealTimeClock())), |
574 rtcp_cname_(GenerateRtcpCname()), | 577 rtcp_cname_(GenerateRtcpCname()), |
575 local_streams_(StreamCollection::Create()), | 578 local_streams_(StreamCollection::Create()), |
576 remote_streams_(StreamCollection::Create()) {} | 579 remote_streams_(StreamCollection::Create()) {} |
577 | 580 |
578 PeerConnection::~PeerConnection() { | 581 PeerConnection::~PeerConnection() { |
579 TRACE_EVENT0("webrtc", "PeerConnection::~PeerConnection"); | 582 TRACE_EVENT0("webrtc", "PeerConnection::~PeerConnection"); |
580 RTC_DCHECK(signaling_thread()->IsCurrent()); | 583 RTC_DCHECK(signaling_thread()->IsCurrent()); |
581 // Need to detach RTP senders/receivers from WebRtcSession, | 584 // Need to detach RTP senders/receivers from WebRtcSession, |
582 // since it's about to be destroyed. | 585 // since it's about to be destroyed. |
583 for (const auto& sender : senders_) { | 586 for (const auto& sender : senders_) { |
(...skipping 28 matching lines...) Expand all Loading... |
612 port_allocator_ = std::move(allocator); | 615 port_allocator_ = std::move(allocator); |
613 | 616 |
614 // The port allocator lives on the network thread and should be initialized | 617 // The port allocator lives on the network thread and should be initialized |
615 // there. | 618 // there. |
616 if (!network_thread()->Invoke<bool>( | 619 if (!network_thread()->Invoke<bool>( |
617 RTC_FROM_HERE, rtc::Bind(&PeerConnection::InitializePortAllocator_n, | 620 RTC_FROM_HERE, rtc::Bind(&PeerConnection::InitializePortAllocator_n, |
618 this, configuration))) { | 621 this, configuration))) { |
619 return false; | 622 return false; |
620 } | 623 } |
621 | 624 |
622 media_controller_.reset( | 625 media_controller_.reset(factory_->CreateMediaController( |
623 factory_->CreateMediaController(configuration.media_config)); | 626 configuration.media_config, event_log_.get())); |
624 | 627 |
625 session_.reset(new WebRtcSession( | 628 session_.reset(new WebRtcSession( |
626 media_controller_.get(), factory_->network_thread(), | 629 media_controller_.get(), factory_->network_thread(), |
627 factory_->worker_thread(), factory_->signaling_thread(), | 630 factory_->worker_thread(), factory_->signaling_thread(), |
628 port_allocator_.get(), | 631 port_allocator_.get(), |
629 std::unique_ptr<cricket::TransportController>( | 632 std::unique_ptr<cricket::TransportController>( |
630 factory_->CreateTransportController( | 633 factory_->CreateTransportController( |
631 port_allocator_.get(), | 634 port_allocator_.get(), |
632 configuration.redetermine_role_on_ice_restart)))); | 635 configuration.redetermine_role_on_ice_restart)))); |
633 | 636 |
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2336 // Call this last since it may create pooled allocator sessions using the | 2339 // Call this last since it may create pooled allocator sessions using the |
2337 // candidate filter set above. | 2340 // candidate filter set above. |
2338 port_allocator_->SetConfiguration(stun_servers, turn_servers, | 2341 port_allocator_->SetConfiguration(stun_servers, turn_servers, |
2339 configuration.ice_candidate_pool_size, | 2342 configuration.ice_candidate_pool_size, |
2340 configuration.prune_turn_ports); | 2343 configuration.prune_turn_ports); |
2341 return true; | 2344 return true; |
2342 } | 2345 } |
2343 | 2346 |
2344 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, | 2347 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, |
2345 int64_t max_size_bytes) { | 2348 int64_t max_size_bytes) { |
2346 return media_controller_->call_w()->StartEventLog(file, max_size_bytes); | 2349 return event_log_->StartLogging(file, max_size_bytes); |
2347 } | 2350 } |
2348 | 2351 |
2349 void PeerConnection::StopRtcEventLog_w() { | 2352 void PeerConnection::StopRtcEventLog_w() { |
2350 media_controller_->call_w()->StopEventLog(); | 2353 event_log_->StopLogging(); |
2351 } | 2354 } |
2352 } // namespace webrtc | 2355 } // namespace webrtc |
OLD | NEW |