Replacing rtc::TimeDelta with webrtc::TimeDelta.

This removes the redundant type and replaces all usages. A slight change
in behavior is that we no longer get nanosecond resolution. This should
not matter since no current code requires nanosecond resolution.

Bug: webrtc:9155
Change-Id: I04334e08c686d95731621a6c8a7e40400d0ae3b2
Reviewed-on: https://webrtc-review.googlesource.com/71163
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23174}
This commit is contained in:
Sebastian Jansson
2018-05-08 14:52:22 +02:00
committed by Commit Bot
parent 5b2b692079
commit 5f83cf0c6d
24 changed files with 101 additions and 324 deletions

View File

@ -192,7 +192,7 @@ TEST(AudioNetworkAdaptorImplTest,
"WebRTC-Audio-BitrateAdaptation/Enabled/WebRTC-Audio-FecAdaptation/"
"Enabled/");
rtc::ScopedFakeClock fake_clock;
fake_clock.AdvanceTime(rtc::TimeDelta::FromMilliseconds(kClockInitialTimeMs));
fake_clock.AdvanceTime(TimeDelta::ms(kClockInitialTimeMs));
auto states = CreateAudioNetworkAdaptor();
AudioEncoderRuntimeConfig config;
config.bitrate_bps = 32000;
@ -210,7 +210,7 @@ TEST(AudioNetworkAdaptorImplTest,
TEST(AudioNetworkAdaptorImplTest,
DumpNetworkMetricsIsCalledOnSetNetworkMetrics) {
rtc::ScopedFakeClock fake_clock;
fake_clock.AdvanceTime(rtc::TimeDelta::FromMilliseconds(kClockInitialTimeMs));
fake_clock.AdvanceTime(TimeDelta::ms(kClockInitialTimeMs));
auto states = CreateAudioNetworkAdaptor();
@ -229,14 +229,14 @@ TEST(AudioNetworkAdaptorImplTest,
DumpNetworkMetrics(NetworkMetricsIs(check), timestamp_check));
states.audio_network_adaptor->SetUplinkBandwidth(kBandwidth);
fake_clock.AdvanceTime(rtc::TimeDelta::FromMilliseconds(100));
fake_clock.AdvanceTime(TimeDelta::ms(100));
timestamp_check += 100;
check.uplink_packet_loss_fraction = kPacketLoss;
EXPECT_CALL(*states.mock_debug_dump_writer,
DumpNetworkMetrics(NetworkMetricsIs(check), timestamp_check));
states.audio_network_adaptor->SetUplinkPacketLossFraction(kPacketLoss);
fake_clock.AdvanceTime(rtc::TimeDelta::FromMilliseconds(50));
fake_clock.AdvanceTime(TimeDelta::ms(50));
timestamp_check += 50;
check.uplink_recoverable_packet_loss_fraction = kRecoverablePacketLoss;
EXPECT_CALL(*states.mock_debug_dump_writer,
@ -244,21 +244,21 @@ TEST(AudioNetworkAdaptorImplTest,
states.audio_network_adaptor->SetUplinkRecoverablePacketLossFraction(
kRecoverablePacketLoss);
fake_clock.AdvanceTime(rtc::TimeDelta::FromMilliseconds(200));
fake_clock.AdvanceTime(TimeDelta::ms(200));
timestamp_check += 200;
check.rtt_ms = kRtt;
EXPECT_CALL(*states.mock_debug_dump_writer,
DumpNetworkMetrics(NetworkMetricsIs(check), timestamp_check));
states.audio_network_adaptor->SetRtt(kRtt);
fake_clock.AdvanceTime(rtc::TimeDelta::FromMilliseconds(150));
fake_clock.AdvanceTime(TimeDelta::ms(150));
timestamp_check += 150;
check.target_audio_bitrate_bps = kTargetAudioBitrate;
EXPECT_CALL(*states.mock_debug_dump_writer,
DumpNetworkMetrics(NetworkMetricsIs(check), timestamp_check));
states.audio_network_adaptor->SetTargetAudioBitrate(kTargetAudioBitrate);
fake_clock.AdvanceTime(rtc::TimeDelta::FromMilliseconds(50));
fake_clock.AdvanceTime(TimeDelta::ms(50));
timestamp_check += 50;
check.overhead_bytes_per_packet = kOverhead;
EXPECT_CALL(*states.mock_debug_dump_writer,

View File

@ -148,8 +148,7 @@ TEST(ControllerManagerTest, DoNotReorderBeforeMinReordingTime) {
CheckControllersOrder(&states, kChracteristicBandwithBps[0],
kChracteristicPacketLossFraction[0],
{kNumControllers - 2, kNumControllers - 1, 0, 1});
fake_clock.AdvanceTime(
rtc::TimeDelta::FromMilliseconds(kMinReorderingTimeMs - 1));
fake_clock.AdvanceTime(TimeDelta::ms(kMinReorderingTimeMs - 1));
// Move uplink bandwidth and packet loss fraction to the other controller's
// characteristic point, which would cause controller manager to reorder the
// controllers if time had reached min reordering time.
@ -170,8 +169,7 @@ TEST(ControllerManagerTest, ReorderBeyondMinReordingTimeAndMinDistance) {
// of two controllers.
CheckControllersOrder(&states, kBandwidthBps, kPacketLossFraction,
{kNumControllers - 2, kNumControllers - 1, 0, 1});
fake_clock.AdvanceTime(
rtc::TimeDelta::FromMilliseconds(kMinReorderingTimeMs));
fake_clock.AdvanceTime(TimeDelta::ms(kMinReorderingTimeMs));
// Then let network metrics move a little towards the other controller.
CheckControllersOrder(&states, kBandwidthBps - kMinBandwithChangeBps - 1,
kPacketLossFraction,
@ -190,8 +188,7 @@ TEST(ControllerManagerTest, DoNotReorderIfNetworkMetricsChangeTooSmall) {
// of two controllers.
CheckControllersOrder(&states, kBandwidthBps, kPacketLossFraction,
{kNumControllers - 2, kNumControllers - 1, 0, 1});
fake_clock.AdvanceTime(
rtc::TimeDelta::FromMilliseconds(kMinReorderingTimeMs));
fake_clock.AdvanceTime(TimeDelta::ms(kMinReorderingTimeMs));
// Then let network metrics move a little towards the other controller.
CheckControllersOrder(&states, kBandwidthBps - kMinBandwithChangeBps + 1,
kPacketLossFraction,
@ -351,7 +348,7 @@ TEST(ControllerManagerTest, DebugDumpLoggedWhenCreateFromConfigString) {
constexpr int64_t kClockInitialTimeMs = 12345678;
rtc::ScopedFakeClock fake_clock;
fake_clock.AdvanceTime(rtc::TimeDelta::FromMilliseconds(kClockInitialTimeMs));
fake_clock.AdvanceTime(TimeDelta::ms(kClockInitialTimeMs));
auto debug_dump_writer =
std::unique_ptr<MockDebugDumpWriter>(new NiceMock<MockDebugDumpWriter>());
EXPECT_CALL(*debug_dump_writer, Die());
@ -448,8 +445,7 @@ TEST(ControllerManagerTest, CreateFromConfigStringAndCheckReordering) {
metrics.uplink_bandwidth_bps = kChracteristicBandwithBps[1];
metrics.uplink_packet_loss_fraction = kChracteristicPacketLossFraction[1];
fake_clock.AdvanceTime(
rtc::TimeDelta::FromMilliseconds(kMinReorderingTimeMs - 1));
fake_clock.AdvanceTime(TimeDelta::ms(kMinReorderingTimeMs - 1));
controllers = states.controller_manager->GetSortedControllers(metrics);
// Should not reorder since min reordering time is not met.
CheckControllersOrder(controllers,
@ -458,7 +454,7 @@ TEST(ControllerManagerTest, CreateFromConfigStringAndCheckReordering) {
ControllerType::CHANNEL, ControllerType::DTX,
ControllerType::BIT_RATE});
fake_clock.AdvanceTime(rtc::TimeDelta::FromMilliseconds(1));
fake_clock.AdvanceTime(TimeDelta::ms(1));
controllers = states.controller_manager->GetSortedControllers(metrics);
// Reorder now.
CheckControllersOrder(controllers,