Chromium Code Reviews| Index: webrtc/call/congestion_controller.cc |
| diff --git a/webrtc/call/congestion_controller.cc b/webrtc/call/congestion_controller.cc |
| index e548a96999c844a16bfc36a53ef39e34f6437a17..73c52dfff3f7ce8a191a1946879af3106bff22fc 100644 |
| --- a/webrtc/call/congestion_controller.cc |
| +++ b/webrtc/call/congestion_controller.cc |
| @@ -10,8 +10,11 @@ |
| #include "webrtc/call/congestion_controller.h" |
| +#include <vector> |
| + |
| #include "webrtc/base/checks.h" |
| #include "webrtc/base/logging.h" |
| +#include "webrtc/base/socket.h" |
| #include "webrtc/base/thread_annotations.h" |
| #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
| #include "webrtc/modules/pacing/paced_sender.h" |
| @@ -21,14 +24,10 @@ |
| #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h" |
| #include "webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h" |
| #include "webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.h" |
| -#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
| #include "webrtc/modules/utility/include/process_thread.h" |
| #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| #include "webrtc/video/call_stats.h" |
| #include "webrtc/video/payload_router.h" |
| -#include "webrtc/video/vie_encoder.h" |
| -#include "webrtc/video/vie_remb.h" |
| -#include "webrtc/voice_engine/include/voe_video_sync.h" |
| namespace webrtc { |
| namespace { |
| @@ -143,19 +142,22 @@ class WrappingBitrateEstimator : public RemoteBitrateEstimator { |
| } // namespace |
| -CongestionController::CongestionController(ProcessThread* process_thread, |
| - CallStats* call_stats, |
| - BitrateObserver* bitrate_observer) |
| - : remb_(new VieRemb(Clock::GetRealTimeClock())), |
| - packet_router_(new PacketRouter()), |
| - pacer_(new PacedSender(Clock::GetRealTimeClock(), |
| +CongestionController::CongestionController( |
| + Clock* clock, |
|
the sun
2016/02/05 15:12:37
Store clock in a field and use instead of GetRealT
stefan-webrtc
2016/02/07 18:29:27
Good suggestion, I don't know why I didn't do that
|
| + ProcessThread* process_thread, |
| + CallStats* call_stats, |
| + BitrateObserver* bitrate_observer, |
| + RemoteBitrateObserver* remote_bitrate_observer) |
| + : packet_router_(new PacketRouter()), |
| + pacer_(new PacedSender(clock, |
| packet_router_.get(), |
| BitrateController::kDefaultStartBitrateKbps, |
| PacedSender::kDefaultPaceMultiplier * |
| BitrateController::kDefaultStartBitrateKbps, |
| 0)), |
| remote_bitrate_estimator_( |
| - new WrappingBitrateEstimator(remb_.get(), Clock::GetRealTimeClock())), |
| + new WrappingBitrateEstimator(remote_bitrate_observer, |
| + Clock::GetRealTimeClock())), |
| remote_estimator_proxy_( |
| new RemoteEstimatorProxy(Clock::GetRealTimeClock(), |
| packet_router_.get())), |
| @@ -165,8 +167,7 @@ CongestionController::CongestionController(ProcessThread* process_thread, |
| // Constructed last as this object calls the provided callback on |
| // construction. |
| bitrate_controller_( |
| - BitrateController::CreateBitrateController(Clock::GetRealTimeClock(), |
| - bitrate_observer)), |
| + BitrateController::CreateBitrateController(clock, bitrate_observer)), |
| min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps) { |
| call_stats_->RegisterStatsObserver(remote_bitrate_estimator_.get()); |
| @@ -174,8 +175,8 @@ CongestionController::CongestionController(ProcessThread* process_thread, |
| pacer_thread_->RegisterModule(remote_estimator_proxy_.get()); |
| pacer_thread_->Start(); |
| - process_thread->RegisterModule(remote_bitrate_estimator_.get()); |
| - process_thread->RegisterModule(bitrate_controller_.get()); |
| + process_thread_->RegisterModule(remote_bitrate_estimator_.get()); |
| + process_thread_->RegisterModule(bitrate_controller_.get()); |
| } |
| CongestionController::~CongestionController() { |
| @@ -187,24 +188,8 @@ CongestionController::~CongestionController() { |
| call_stats_->DeregisterStatsObserver(remote_bitrate_estimator_.get()); |
| if (transport_feedback_adapter_.get()) |
| call_stats_->DeregisterStatsObserver(transport_feedback_adapter_.get()); |
| - RTC_DCHECK(!remb_->InUse()); |
| - RTC_DCHECK(encoders_.empty()); |
| -} |
| - |
| -void CongestionController::AddEncoder(ViEEncoder* encoder) { |
| - rtc::CritScope lock(&encoder_crit_); |
| - encoders_.push_back(encoder); |
| } |
| -void CongestionController::RemoveEncoder(ViEEncoder* encoder) { |
| - rtc::CritScope lock(&encoder_crit_); |
| - for (auto it = encoders_.begin(); it != encoders_.end(); ++it) { |
| - if (*it == encoder) { |
| - encoders_.erase(it); |
| - return; |
| - } |
| - } |
| -} |
| void CongestionController::SetBweBitrates(int min_bitrate_bps, |
| int start_bitrate_bps, |
| @@ -258,23 +243,6 @@ int64_t CongestionController::GetPacerQueuingDelayMs() const { |
| return pacer_->QueueInMs(); |
| } |
| -// TODO(mflodman): Move out of this class. |
| -void CongestionController::SetChannelRembStatus(bool sender, |
| - bool receiver, |
| - RtpRtcp* rtp_module) { |
| - rtp_module->SetREMBStatus(sender || receiver); |
| - if (sender) { |
| - remb_->AddRembSender(rtp_module); |
| - } else { |
| - remb_->RemoveRembSender(rtp_module); |
| - } |
| - if (receiver) { |
| - remb_->AddReceiveChannel(rtp_module); |
| - } else { |
| - remb_->RemoveReceiveChannel(rtp_module); |
| - } |
| -} |
| - |
| void CongestionController::SignalNetworkState(NetworkState state) { |
| if (state == kNetworkUp) { |
| pacer_->Resume(); |