| 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 : factory_(factory), | 395 : factory_(factory), |
| 396 observer_(NULL), | 396 observer_(NULL), |
| 397 uma_observer_(NULL), | 397 uma_observer_(NULL), |
| 398 event_log_(RtcEventLog::Create()), |
| 398 signaling_state_(kStable), | 399 signaling_state_(kStable), |
| 399 ice_connection_state_(kIceConnectionNew), | 400 ice_connection_state_(kIceConnectionNew), |
| 400 ice_gathering_state_(kIceGatheringNew), | 401 ice_gathering_state_(kIceGatheringNew), |
| 401 event_log_(RtcEventLog::Create()), | |
| 402 rtcp_cname_(GenerateRtcpCname()), | 402 rtcp_cname_(GenerateRtcpCname()), |
| 403 local_streams_(StreamCollection::Create()), | 403 local_streams_(StreamCollection::Create()), |
| 404 remote_streams_(StreamCollection::Create()) {} | 404 remote_streams_(StreamCollection::Create()) {} |
| 405 | 405 |
| 406 PeerConnection::~PeerConnection() { | 406 PeerConnection::~PeerConnection() { |
| 407 TRACE_EVENT0("webrtc", "PeerConnection::~PeerConnection"); | 407 TRACE_EVENT0("webrtc", "PeerConnection::~PeerConnection"); |
| 408 RTC_DCHECK(signaling_thread()->IsCurrent()); | 408 RTC_DCHECK(signaling_thread()->IsCurrent()); |
| 409 // Need to detach RTP senders/receivers from WebRtcSession, | 409 // Need to detach RTP senders/receivers from WebRtcSession, |
| 410 // since it's about to be destroyed. | 410 // since it's about to be destroyed. |
| 411 for (const auto& sender : senders_) { | 411 for (const auto& sender : senders_) { |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 return session_->pending_remote_description(); | 1282 return session_->pending_remote_description(); |
| 1283 } | 1283 } |
| 1284 | 1284 |
| 1285 void PeerConnection::Close() { | 1285 void PeerConnection::Close() { |
| 1286 TRACE_EVENT0("webrtc", "PeerConnection::Close"); | 1286 TRACE_EVENT0("webrtc", "PeerConnection::Close"); |
| 1287 // Update stats here so that we have the most recent stats for tracks and | 1287 // Update stats here so that we have the most recent stats for tracks and |
| 1288 // streams before the channels are closed. | 1288 // streams before the channels are closed. |
| 1289 stats_->UpdateStats(kStatsOutputLevelStandard); | 1289 stats_->UpdateStats(kStatsOutputLevelStandard); |
| 1290 | 1290 |
| 1291 session_->Close(); | 1291 session_->Close(); |
| 1292 event_log_.reset(); | |
| 1293 network_thread()->Invoke<void>( | 1292 network_thread()->Invoke<void>( |
| 1294 RTC_FROM_HERE, | 1293 RTC_FROM_HERE, |
| 1295 rtc::Bind(&cricket::PortAllocator::DiscardCandidatePool, | 1294 rtc::Bind(&cricket::PortAllocator::DiscardCandidatePool, |
| 1296 port_allocator_.get())); | 1295 port_allocator_.get())); |
| 1297 | 1296 |
| 1298 factory_->worker_thread()->Invoke<void>(RTC_FROM_HERE, | 1297 factory_->worker_thread()->Invoke<void>(RTC_FROM_HERE, |
| 1299 [this] { call_.reset(); }); | 1298 [this] { call_.reset(); }); |
| 1299 |
| 1300 // The event log must outlive call (and any other object that uses it). |
| 1301 event_log_.reset(); |
| 1300 } | 1302 } |
| 1301 | 1303 |
| 1302 void PeerConnection::OnSessionStateChange(WebRtcSession* /*session*/, | 1304 void PeerConnection::OnSessionStateChange(WebRtcSession* /*session*/, |
| 1303 WebRtcSession::State state) { | 1305 WebRtcSession::State state) { |
| 1304 switch (state) { | 1306 switch (state) { |
| 1305 case WebRtcSession::STATE_INIT: | 1307 case WebRtcSession::STATE_INIT: |
| 1306 ChangeSignalingState(PeerConnectionInterface::kStable); | 1308 ChangeSignalingState(PeerConnectionInterface::kStable); |
| 1307 break; | 1309 break; |
| 1308 case WebRtcSession::STATE_SENTOFFER: | 1310 case WebRtcSession::STATE_SENTOFFER: |
| 1309 ChangeSignalingState(PeerConnectionInterface::kHaveLocalOffer); | 1311 ChangeSignalingState(PeerConnectionInterface::kHaveLocalOffer); |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2336 call_config.audio_state = | 2338 call_config.audio_state = |
| 2337 factory_->channel_manager() ->media_engine()->GetAudioState(); | 2339 factory_->channel_manager() ->media_engine()->GetAudioState(); |
| 2338 call_config.bitrate_config.min_bitrate_bps = kMinBandwidthBps; | 2340 call_config.bitrate_config.min_bitrate_bps = kMinBandwidthBps; |
| 2339 call_config.bitrate_config.start_bitrate_bps = kStartBandwidthBps; | 2341 call_config.bitrate_config.start_bitrate_bps = kStartBandwidthBps; |
| 2340 call_config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; | 2342 call_config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; |
| 2341 | 2343 |
| 2342 call_.reset(webrtc::Call::Create(call_config)); | 2344 call_.reset(webrtc::Call::Create(call_config)); |
| 2343 } | 2345 } |
| 2344 | 2346 |
| 2345 } // namespace webrtc | 2347 } // namespace webrtc |
| OLD | NEW |