Disabling periodic tasks on SSCC in unit tests.

Time triggered tasks in the SendSideCongestionController caused
flakyness in long running unit tests of SendSideCongestionController.

This CL lets the unit test code disable the periodic tasks so they are
only triggered on demand.

Bug: webrtc:9039
Change-Id: I934045d7e6eeaa765dd221cef87389f1d98b58a5
Reviewed-on: https://webrtc-review.googlesource.com/63265
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22536}
This commit is contained in:
Sebastian Jansson
2018-03-20 11:31:31 +01:00
committed by Commit Bot
parent 81e8a43b4b
commit 247e0b4713
3 changed files with 19 additions and 7 deletions

View File

@ -314,6 +314,7 @@ SendSideCongestionController::SendSideCongestionController(
webrtc::field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")),
transport_overhead_bytes_per_packet_(0),
network_available_(false),
periodic_tasks_enabled_(true),
task_queue_(MakeUnique<rtc::TaskQueue>("SendSideCCQueue")) {
task_queue_ptr_ = task_queue_.get();
initial_config_.constraints =
@ -543,6 +544,8 @@ void SendSideCongestionController::Process() {
}
void SendSideCongestionController::StartProcessPeriodicTasks() {
if (!periodic_tasks_enabled_)
return;
task_queue_ptr_->PostDelayedTask(
NewPeriodicTask(
rtc::Bind(
@ -653,6 +656,13 @@ void SendSideCongestionController::SetPacingFactor(float pacing_factor) {
});
}
void SendSideCongestionController::DisablePeriodicTasks() {
task_queue_->PostTask([this]() {
RTC_DCHECK_RUN_ON(task_queue_ptr_);
periodic_tasks_enabled_ = false;
});
}
void SendSideCongestionController::OnReceivedEstimatedBitrate(
uint32_t bitrate) {
RemoteBitrateReport msg;