Use newer version of TimeDelta and TimeStamp factories in modules/

This change generated with following commands:
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Micros<\(.*\)>()/TimeDelta::Micros(\1)/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Millis<\(.*\)>()/TimeDelta::Millis(\1)/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::Seconds<\(.*\)>()/TimeDelta::Seconds(\1)/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::us/TimeDelta::Micros/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::ms/TimeDelta::Millis/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/TimeDelta::seconds/TimeDelta::Seconds/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Micros<\(.*\)>()/Timestamp::Micros(\1)/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Millis<\(.*\)>()/Timestamp::Millis(\1)/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::Seconds<\(.*\)>()/Timestamp::Seconds(\1)/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::us/Timestamp::Micros/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::ms/Timestamp::Millis/g"
find modules -type f \( -name "*.h" -o -name "*.cc" \) | xargs sed -i -e "s/Timestamp::seconds/Timestamp::Seconds/g"
git cl format

Bug: None
Change-Id: I117d64a54950be040d996035c54bc0043310943a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168340
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30489}
This commit is contained in:
Danil Chapovalov
2020-02-07 14:53:52 +01:00
committed by Commit Bot
parent 2fe31a47b6
commit 5528402ef8
71 changed files with 517 additions and 498 deletions

View File

@ -924,11 +924,11 @@ AudioEncoderOpusImpl::GetFrameLengthRange() const {
if (config_.supported_frame_lengths_ms.empty()) {
return absl::nullopt;
} else if (audio_network_adaptor_) {
return {{TimeDelta::ms(config_.supported_frame_lengths_ms.front()),
TimeDelta::ms(config_.supported_frame_lengths_ms.back())}};
return {{TimeDelta::Millis(config_.supported_frame_lengths_ms.front()),
TimeDelta::Millis(config_.supported_frame_lengths_ms.back())}};
} else {
return {{TimeDelta::ms(config_.frame_size_ms),
TimeDelta::ms(config_.frame_size_ms)}};
return {{TimeDelta::Millis(config_.frame_size_ms),
TimeDelta::Millis(config_.frame_size_ms)}};
}
}

View File

@ -57,7 +57,7 @@ std::unique_ptr<AudioEncoderOpusStates> CreateCodec(int sample_rate_hz,
std::make_unique<AudioEncoderOpusStates>();
states->mock_audio_network_adaptor = nullptr;
states->fake_clock.reset(new rtc::ScopedFakeClock());
states->fake_clock->SetTime(Timestamp::us(kInitialTimeUs));
states->fake_clock->SetTime(Timestamp::Micros(kInitialTimeUs));
MockAudioNetworkAdaptor** mock_ptr = &states->mock_audio_network_adaptor;
AudioEncoderOpusImpl::AudioNetworkAdaptorCreator creator =
@ -249,7 +249,7 @@ void TestSetPacketLossRate(const AudioEncoderOpusStates* states,
constexpr int64_t kSampleIntervalMs = 184198;
for (float loss : losses) {
states->encoder->OnReceivedUplinkPacketLossFraction(loss);
states->fake_clock->AdvanceTime(TimeDelta::ms(kSampleIntervalMs));
states->fake_clock->AdvanceTime(TimeDelta::Millis(kSampleIntervalMs));
EXPECT_FLOAT_EQ(expected_return, states->encoder->packet_loss_rate());
}
}
@ -429,7 +429,7 @@ TEST_P(AudioEncoderOpusTest,
states->encoder->OnReceivedUplinkPacketLossFraction(kPacketLossFraction_1);
EXPECT_FLOAT_EQ(0.01f, states->encoder->packet_loss_rate());
states->fake_clock->AdvanceTime(TimeDelta::ms(kSecondSampleTimeMs));
states->fake_clock->AdvanceTime(TimeDelta::Millis(kSecondSampleTimeMs));
states->encoder->OnReceivedUplinkPacketLossFraction(kPacketLossFraction_2);
// Now the output of packet loss fraction smoother should be
@ -667,8 +667,8 @@ TEST_P(AudioEncoderOpusTest, UpdateUplinkBandwidthInAudioNetworkAdaptor) {
// Repeat update uplink bandwidth tests.
for (int i = 0; i < 5; i++) {
// Don't update till it is time to update again.
states->fake_clock->AdvanceTime(
TimeDelta::ms(states->config.uplink_bandwidth_update_interval_ms - 1));
states->fake_clock->AdvanceTime(TimeDelta::Millis(
states->config.uplink_bandwidth_update_interval_ms - 1));
states->encoder->Encode(
0, rtc::ArrayView<const int16_t>(audio.data(), audio.size()), &encoded);
@ -676,7 +676,7 @@ TEST_P(AudioEncoderOpusTest, UpdateUplinkBandwidthInAudioNetworkAdaptor) {
EXPECT_CALL(*states->mock_bitrate_smoother, GetAverage())
.WillOnce(Return(40000));
EXPECT_CALL(*states->mock_audio_network_adaptor, SetUplinkBandwidth(40000));
states->fake_clock->AdvanceTime(TimeDelta::ms(1));
states->fake_clock->AdvanceTime(TimeDelta::Millis(1));
states->encoder->Encode(
0, rtc::ArrayView<const int16_t>(audio.data(), audio.size()), &encoded);
}