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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 stats_collector_->WaitForPendingRequest(); | 418 stats_collector_->WaitForPendingRequest(); |
419 stats_collector_ = nullptr; | 419 stats_collector_ = nullptr; |
420 } | 420 } |
421 // Now destroy session_ before destroying other members, | 421 // Now destroy session_ before destroying other members, |
422 // because its destruction fires signals (such as VoiceChannelDestroyed) | 422 // because its destruction fires signals (such as VoiceChannelDestroyed) |
423 // which will trigger some final actions in PeerConnection... | 423 // which will trigger some final actions in PeerConnection... |
424 session_.reset(nullptr); | 424 session_.reset(nullptr); |
425 // port_allocator_ lives on the network thread and should be destroyed there. | 425 // port_allocator_ lives on the network thread and should be destroyed there. |
426 network_thread()->Invoke<void>(RTC_FROM_HERE, | 426 network_thread()->Invoke<void>(RTC_FROM_HERE, |
427 [this] { port_allocator_.reset(); }); | 427 [this] { port_allocator_.reset(); }); |
428 // call_ must be destroyed on the worker thread. | 428 // call_ and event_log_ must be destroyed on the worker thread. |
429 factory_->worker_thread()->Invoke<void>(RTC_FROM_HERE, | 429 factory_->worker_thread()->Invoke<void>(RTC_FROM_HERE, [this] { |
430 [this] { call_.reset(); }); | 430 call_.reset(); |
| 431 event_log_.reset(); |
| 432 }); |
431 } | 433 } |
432 | 434 |
433 bool PeerConnection::Initialize( | 435 bool PeerConnection::Initialize( |
434 const PeerConnectionInterface::RTCConfiguration& configuration, | 436 const PeerConnectionInterface::RTCConfiguration& configuration, |
435 std::unique_ptr<cricket::PortAllocator> allocator, | 437 std::unique_ptr<cricket::PortAllocator> allocator, |
436 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator, | 438 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator, |
437 PeerConnectionObserver* observer) { | 439 PeerConnectionObserver* observer) { |
438 TRACE_EVENT0("webrtc", "PeerConnection::Initialize"); | 440 TRACE_EVENT0("webrtc", "PeerConnection::Initialize"); |
439 | 441 |
440 RTCError config_error = ValidateConfiguration(configuration); | 442 RTCError config_error = ValidateConfiguration(configuration); |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 // Update stats here so that we have the most recent stats for tracks and | 1332 // Update stats here so that we have the most recent stats for tracks and |
1331 // streams before the channels are closed. | 1333 // streams before the channels are closed. |
1332 stats_->UpdateStats(kStatsOutputLevelStandard); | 1334 stats_->UpdateStats(kStatsOutputLevelStandard); |
1333 | 1335 |
1334 session_->Close(); | 1336 session_->Close(); |
1335 network_thread()->Invoke<void>( | 1337 network_thread()->Invoke<void>( |
1336 RTC_FROM_HERE, | 1338 RTC_FROM_HERE, |
1337 rtc::Bind(&cricket::PortAllocator::DiscardCandidatePool, | 1339 rtc::Bind(&cricket::PortAllocator::DiscardCandidatePool, |
1338 port_allocator_.get())); | 1340 port_allocator_.get())); |
1339 | 1341 |
1340 factory_->worker_thread()->Invoke<void>(RTC_FROM_HERE, | 1342 factory_->worker_thread()->Invoke<void>(RTC_FROM_HERE, [this] { |
1341 [this] { call_.reset(); }); | 1343 call_.reset(); |
1342 | 1344 // The event log must outlive call (and any other object that uses it). |
1343 // The event log must outlive call (and any other object that uses it). | 1345 event_log_.reset(); |
1344 event_log_.reset(); | 1346 }); |
1345 } | 1347 } |
1346 | 1348 |
1347 void PeerConnection::OnSessionStateChange(WebRtcSession* /*session*/, | 1349 void PeerConnection::OnSessionStateChange(WebRtcSession* /*session*/, |
1348 WebRtcSession::State state) { | 1350 WebRtcSession::State state) { |
1349 switch (state) { | 1351 switch (state) { |
1350 case WebRtcSession::STATE_INIT: | 1352 case WebRtcSession::STATE_INIT: |
1351 ChangeSignalingState(PeerConnectionInterface::kStable); | 1353 ChangeSignalingState(PeerConnectionInterface::kStable); |
1352 break; | 1354 break; |
1353 case WebRtcSession::STATE_SENTOFFER: | 1355 case WebRtcSession::STATE_SENTOFFER: |
1354 ChangeSignalingState(PeerConnectionInterface::kHaveLocalOffer); | 1356 ChangeSignalingState(PeerConnectionInterface::kHaveLocalOffer); |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2524 return event_log_->StartLogging(file, max_size_bytes); | 2526 return event_log_->StartLogging(file, max_size_bytes); |
2525 } | 2527 } |
2526 | 2528 |
2527 void PeerConnection::StopRtcEventLog_w() { | 2529 void PeerConnection::StopRtcEventLog_w() { |
2528 if (event_log_) { | 2530 if (event_log_) { |
2529 event_log_->StopLogging(); | 2531 event_log_->StopLogging(); |
2530 } | 2532 } |
2531 } | 2533 } |
2532 | 2534 |
2533 } // namespace webrtc | 2535 } // namespace webrtc |
OLD | NEW |