Revert of Move congestion controller processing to the pacer thread. (patchset #5 id:80001 of https://codereview.webrtc.org/2637783003/ )

Reason for revert:
Speculative revert for perf regression related to ramp-up on android. See https://bugs.chromium.org/p/chromium/issues/detail?id=682611

Original issue's description:
> Move congestion controller processing to the pacer thread.
>
> Also rename it from pacer_thread_ to congestion_controller_thread_.
>
> BUG=webrtc:6847
>
> Review-Url: https://codereview.webrtc.org/2637783003
> Cr-Commit-Position: refs/heads/master@{#16134}
> Committed: b3dc2b7b1e

TBR=danilchap@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:6847

Review-Url: https://codereview.webrtc.org/2644603003
Cr-Commit-Position: refs/heads/master@{#16163}
This commit is contained in:
nisse 2017-01-19 05:41:25 -08:00 committed by Commit bot
parent 6ce9259cb0
commit b93598465d
4 changed files with 18 additions and 23 deletions

View File

@ -173,7 +173,7 @@ class Call : public webrtc::Call,
const int num_cpu_cores_;
const std::unique_ptr<ProcessThread> module_process_thread_;
const std::unique_ptr<ProcessThread> congestion_controller_thread_;
const std::unique_ptr<ProcessThread> pacer_thread_;
const std::unique_ptr<CallStats> call_stats_;
const std::unique_ptr<BitrateAllocator> bitrate_allocator_;
Call::Config config_;
@ -277,8 +277,7 @@ Call::Call(const Call::Config& config)
: clock_(Clock::GetRealTimeClock()),
num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
module_process_thread_(ProcessThread::Create("ModuleProcessThread")),
congestion_controller_thread_(
ProcessThread::Create("CongestionControllerThread")),
pacer_thread_(ProcessThread::Create("PacerThread")),
call_stats_(new CallStats(clock_)),
bitrate_allocator_(new BitrateAllocator(this)),
config_(config),
@ -325,8 +324,11 @@ Call::Call(const Call::Config& config)
module_process_thread_->Start();
module_process_thread_->RegisterModule(call_stats_.get());
congestion_controller_thread_->RegisterModule(congestion_controller_.get());
congestion_controller_thread_->Start();
module_process_thread_->RegisterModule(congestion_controller_.get());
pacer_thread_->RegisterModule(congestion_controller_->pacer());
pacer_thread_->RegisterModule(
congestion_controller_->GetRemoteBitrateEstimator(true));
pacer_thread_->Start();
}
Call::~Call() {
@ -340,8 +342,11 @@ Call::~Call() {
RTC_CHECK(video_receive_ssrcs_.empty());
RTC_CHECK(video_receive_streams_.empty());
congestion_controller_thread_->Stop();
congestion_controller_thread_->DeRegisterModule(congestion_controller_.get());
pacer_thread_->Stop();
pacer_thread_->DeRegisterModule(congestion_controller_->pacer());
pacer_thread_->DeRegisterModule(
congestion_controller_->GetRemoteBitrateEstimator(true));
module_process_thread_->DeRegisterModule(congestion_controller_.get());
module_process_thread_->DeRegisterModule(call_stats_.get());
module_process_thread_->Stop();
call_stats_->DeregisterStatsObserver(congestion_controller_.get());

View File

@ -327,19 +327,15 @@ void CongestionController::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) {
}
int64_t CongestionController::TimeUntilNextProcess() {
return std::min({bitrate_controller_->TimeUntilNextProcess(),
remote_bitrate_estimator_->TimeUntilNextProcess(),
pacer_->TimeUntilNextProcess(),
remote_estimator_proxy_.TimeUntilNextProcess()});
return std::min(bitrate_controller_->TimeUntilNextProcess(),
remote_bitrate_estimator_->TimeUntilNextProcess());
}
void CongestionController::Process() {
bitrate_controller_->Process();
remote_bitrate_estimator_->Process();
MaybeTriggerOnNetworkChanged();
probe_controller_->Process();
pacer_->Process();
remote_estimator_proxy_.Process();
MaybeTriggerOnNetworkChanged();
}
void CongestionController::MaybeTriggerOnNetworkChanged() {

View File

@ -36,10 +36,6 @@ AlrDetector::AlrDetector()
AlrDetector::~AlrDetector() {}
void AlrDetector::OnBytesSent(size_t bytes_sent, int64_t now_ms) {
// TODO(nisse): It's unclear what guarantees there are that this
// function isn't called before SetEstimatedBitrate. Document that
// guarantee, if it exists. Or else, remove the DCHECK and tolerate
// that current estimate is zero, e.g., by just returning false.
RTC_DCHECK(estimated_bitrate_bps_);
rate_.Update(bytes_sent, now_ms);

View File

@ -450,11 +450,9 @@ void PacedSender::Process() {
bytes_sent += SendPadding(padding_needed, probe_cluster_id);
}
}
if (bytes_sent > 0) {
if (is_probing)
prober_->ProbeSent(clock_->TimeInMilliseconds(), bytes_sent);
alr_detector_->OnBytesSent(bytes_sent, now_us / 1000);
}
if (is_probing && bytes_sent > 0)
prober_->ProbeSent(clock_->TimeInMilliseconds(), bytes_sent);
alr_detector_->OnBytesSent(bytes_sent, now_us / 1000);
}
bool PacedSender::SendPacket(const paced_sender::Packet& packet,