OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 442 |
443 module_process_thread_->RegisterModule(&overuse_detector_); | 443 module_process_thread_->RegisterModule(&overuse_detector_); |
444 | 444 |
445 encoder_thread_.Start(); | 445 encoder_thread_.Start(); |
446 encoder_thread_.SetPriority(rtc::kHighPriority); | 446 encoder_thread_.SetPriority(rtc::kHighPriority); |
447 } | 447 } |
448 | 448 |
449 VideoSendStream::~VideoSendStream() { | 449 VideoSendStream::~VideoSendStream() { |
450 LOG(LS_INFO) << "~VideoSendStream: " << config_.ToString(); | 450 LOG(LS_INFO) << "~VideoSendStream: " << config_.ToString(); |
451 | 451 |
452 bitrate_allocator_->RemoveObserver(this); | |
453 Stop(); | 452 Stop(); |
454 | 453 |
455 // Stop the encoder thread permanently. | 454 // Stop the encoder thread permanently. |
456 rtc::AtomicOps::ReleaseStore(&stop_encoder_thread_, 1); | 455 rtc::AtomicOps::ReleaseStore(&stop_encoder_thread_, 1); |
457 encoder_wakeup_event_.Set(); | 456 encoder_wakeup_event_.Set(); |
458 encoder_thread_.Stop(); | 457 encoder_thread_.Stop(); |
459 | 458 |
| 459 // This needs to happen after stopping the encoder thread, |
| 460 // since the encoder thread calls AddObserver. |
| 461 bitrate_allocator_->RemoveObserver(this); |
| 462 |
460 module_process_thread_->DeRegisterModule(&overuse_detector_); | 463 module_process_thread_->DeRegisterModule(&overuse_detector_); |
461 vie_channel_.RegisterSendFrameCountObserver(nullptr); | 464 vie_channel_.RegisterSendFrameCountObserver(nullptr); |
462 vie_channel_.RegisterSendBitrateObserver(nullptr); | 465 vie_channel_.RegisterSendBitrateObserver(nullptr); |
463 vie_channel_.RegisterRtcpPacketTypeCounterObserver(nullptr); | 466 vie_channel_.RegisterRtcpPacketTypeCounterObserver(nullptr); |
464 | 467 |
465 call_stats_->DeregisterStatsObserver(vie_channel_.GetStatsObserver()); | 468 call_stats_->DeregisterStatsObserver(vie_channel_.GetStatsObserver()); |
466 rtp_rtcp_modules_[0]->SetREMBStatus(false); | 469 rtp_rtcp_modules_[0]->SetREMBStatus(false); |
467 remb_->RemoveRembSender(rtp_rtcp_modules_[0]); | 470 remb_->RemoveRembSender(rtp_rtcp_modules_[0]); |
468 | 471 |
469 // ViEChannel outlives ViEEncoder so remove encoder from feedback before | 472 // ViEChannel outlives ViEEncoder so remove encoder from feedback before |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 } | 663 } |
661 | 664 |
662 void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps, | 665 void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps, |
663 uint8_t fraction_loss, | 666 uint8_t fraction_loss, |
664 int64_t rtt) { | 667 int64_t rtt) { |
665 vie_encoder_.OnBitrateUpdated(bitrate_bps, fraction_loss, rtt); | 668 vie_encoder_.OnBitrateUpdated(bitrate_bps, fraction_loss, rtt); |
666 } | 669 } |
667 | 670 |
668 } // namespace internal | 671 } // namespace internal |
669 } // namespace webrtc | 672 } // namespace webrtc |
OLD | NEW |