diff --git a/audio/audio_send_stream_unittest.cc b/audio/audio_send_stream_unittest.cc index e20b031079..21f22185a5 100644 --- a/audio/audio_send_stream_unittest.cc +++ b/audio/audio_send_stream_unittest.cc @@ -28,6 +28,7 @@ #include "modules/rtp_rtcp/mocks/mock_rtcp_rtt_stats.h" #include "modules/rtp_rtcp/mocks/mock_rtp_rtcp.h" #include "rtc_base/task_queue.h" +#include "system_wrappers/include/clock.h" #include "test/field_trial.h" #include "test/gtest.h" #include "test/mock_audio_encoder.h" @@ -125,9 +126,10 @@ rtc::scoped_refptr SetupEncoderFactoryMock() { struct ConfigHelper { ConfigHelper(bool audio_bwe_enabled, bool expect_set_encoder_call) - : stream_config_(/*send_transport=*/nullptr, /*media_transport=*/nullptr), + : clock_(1000000), + stream_config_(/*send_transport=*/nullptr, /*media_transport=*/nullptr), audio_processing_(new rtc::RefCountedObject()), - bitrate_allocator_(&limit_observer_), + bitrate_allocator_(&clock_, &limit_observer_), worker_queue_("ConfigHelper_worker_queue"), audio_encoder_(nullptr) { using testing::Invoke; @@ -283,6 +285,7 @@ struct ConfigHelper { } private: + SimulatedClock clock_; rtc::scoped_refptr audio_state_; AudioSendStream::Config stream_config_; testing::StrictMock* channel_send_ = nullptr; diff --git a/call/bitrate_allocator.cc b/call/bitrate_allocator.cc index 21939a7e47..9ddc78653a 100644 --- a/call/bitrate_allocator.cc +++ b/call/bitrate_allocator.cc @@ -51,7 +51,7 @@ double MediaRatio(uint32_t allocated_bitrate, uint32_t protection_bitrate) { } // namespace -BitrateAllocator::BitrateAllocator(LimitObserver* limit_observer) +BitrateAllocator::BitrateAllocator(Clock* clock, LimitObserver* limit_observer) : limit_observer_(limit_observer), last_target_bps_(0), last_link_capacity_bps_(0), @@ -60,7 +60,7 @@ BitrateAllocator::BitrateAllocator(LimitObserver* limit_observer) last_rtt_(0), last_bwe_period_ms_(1000), num_pause_events_(0), - clock_(Clock::GetRealTimeClock()), + clock_(clock), last_bwe_log_time_(0), total_requested_padding_bitrate_(0), total_requested_min_bitrate_(0), diff --git a/call/bitrate_allocator.h b/call/bitrate_allocator.h index 43e89b2936..bb2d149c80 100644 --- a/call/bitrate_allocator.h +++ b/call/bitrate_allocator.h @@ -90,7 +90,7 @@ class BitrateAllocator : public BitrateAllocatorInterface { virtual ~LimitObserver() = default; }; - explicit BitrateAllocator(LimitObserver* limit_observer); + BitrateAllocator(Clock* clock, LimitObserver* limit_observer); ~BitrateAllocator() override; void UpdateStartRate(uint32_t start_rate_bps); diff --git a/call/bitrate_allocator_unittest.cc b/call/bitrate_allocator_unittest.cc index 33747efb34..4441326db9 100644 --- a/call/bitrate_allocator_unittest.cc +++ b/call/bitrate_allocator_unittest.cc @@ -87,7 +87,8 @@ const double kDefaultBitratePriority = 1.0; class BitrateAllocatorTest : public ::testing::Test { protected: BitrateAllocatorTest() - : allocator_(new BitrateAllocatorForTest(&limit_observer_)) { + : allocator_(new BitrateAllocatorForTest(Clock::GetRealTimeClock(), + &limit_observer_)) { allocator_->OnNetworkChanged(300000u, 0, 0, kDefaultProbingIntervalMs); } ~BitrateAllocatorTest() {} @@ -267,7 +268,8 @@ TEST_F(BitrateAllocatorTest, RemoveObserverTriggersLimitObserver) { class BitrateAllocatorTestNoEnforceMin : public ::testing::Test { protected: BitrateAllocatorTestNoEnforceMin() - : allocator_(new BitrateAllocatorForTest(&limit_observer_)) { + : allocator_(new BitrateAllocatorForTest(Clock::GetRealTimeClock(), + &limit_observer_)) { allocator_->OnNetworkChanged(300000u, 0, 0, kDefaultProbingIntervalMs); } ~BitrateAllocatorTestNoEnforceMin() {} diff --git a/call/call.cc b/call/call.cc index 08a23e2bae..85a9c5c6a7 100644 --- a/call/call.cc +++ b/call/call.cc @@ -454,7 +454,7 @@ Call::Call(const Call::Config& config, num_cpu_cores_(CpuInfo::DetectNumberOfCores()), module_process_thread_(std::move(module_process_thread)), call_stats_(new CallStats(clock_, module_process_thread_.get())), - bitrate_allocator_(new BitrateAllocator(this)), + bitrate_allocator_(new BitrateAllocator(clock_, this)), config_(config), audio_network_state_(kNetworkDown), video_network_state_(kNetworkDown),