diff --git a/api/rtp_headers.h b/api/rtp_headers.h index 44d2deeb90..163347f675 100644 --- a/api/rtp_headers.h +++ b/api/rtp_headers.h @@ -101,8 +101,8 @@ struct RTPHeaderExtension { Timestamp GetAbsoluteSendTimestamp() const { RTC_DCHECK(hasAbsoluteSendTime); RTC_DCHECK(absoluteSendTime < (1ul << 24)); - return Timestamp::us((absoluteSendTime * 1000000ll) / - (1 << kAbsSendTimeFraction)); + return Timestamp::Micros((absoluteSendTime * 1000000ll) / + (1 << kAbsSendTimeFraction)); } TimeDelta GetAbsoluteSendTimeDelta(uint32_t previous_sendtime) const { @@ -111,7 +111,7 @@ struct RTPHeaderExtension { RTC_DCHECK(previous_sendtime < (1ul << 24)); int32_t delta = static_cast((absoluteSendTime - previous_sendtime) << 8) >> 8; - return TimeDelta::us((delta * 1000000ll) / (1 << kAbsSendTimeFraction)); + return TimeDelta::Micros((delta * 1000000ll) / (1 << kAbsSendTimeFraction)); } bool hasTransmissionTimeOffset; diff --git a/api/test/create_time_controller.cc b/api/test/create_time_controller.cc index 794f7ccfcc..d3b046bd61 100644 --- a/api/test/create_time_controller.cc +++ b/api/test/create_time_controller.cc @@ -25,7 +25,7 @@ std::unique_ptr CreateTimeController( std::unique_ptr CreateSimulatedTimeController() { return std::make_unique( - Timestamp::seconds(10000)); + Timestamp::Seconds(10000)); } std::unique_ptr CreateTimeControllerBasedCallFactory( diff --git a/api/test/create_time_controller_unittest.cc b/api/test/create_time_controller_unittest.cc index e39a453da0..0ea868c5cc 100644 --- a/api/test/create_time_controller_unittest.cc +++ b/api/test/create_time_controller_unittest.cc @@ -68,7 +68,7 @@ void FakeAlarm::Sleep(TimeDelta duration) { } TEST(CreateTimeControllerTest, CreatesNonNullController) { - FakeAlarm alarm(Timestamp::ms(100)); + FakeAlarm alarm(Timestamp::Millis(100)); EXPECT_NE(CreateTimeController(&alarm), nullptr); } diff --git a/api/test/loopback_media_transport.cc b/api/test/loopback_media_transport.cc index 847ca4864a..18ce93cd7e 100644 --- a/api/test/loopback_media_transport.cc +++ b/api/test/loopback_media_transport.cc @@ -280,7 +280,7 @@ RTCError MediaTransportPair::LoopbackDatagramTransport::SendDatagram( if (sink_) { DatagramAck ack; ack.datagram_id = datagram_id; - ack.receive_timestamp = Timestamp::us(rtc::TimeMicros()); + ack.receive_timestamp = Timestamp::Micros(rtc::TimeMicros()); sink_->OnDatagramAcked(ack); } }); diff --git a/api/test/peerconnection_quality_test_fixture.h b/api/test/peerconnection_quality_test_fixture.h index 7e9282b2ad..3721665a98 100644 --- a/api/test/peerconnection_quality_test_fixture.h +++ b/api/test/peerconnection_quality_test_fixture.h @@ -322,7 +322,7 @@ class PeerConnectionE2EQualityTestFixture { struct EchoEmulationConfig { // Delay which represents the echo path delay, i.e. how soon rendered signal // should reach capturer. - TimeDelta echo_delay = TimeDelta::ms(50); + TimeDelta echo_delay = TimeDelta::Millis(50); }; struct VideoCodecConfig { diff --git a/api/test/time_controller.cc b/api/test/time_controller.cc index b3b2f463c5..f2b1a05c16 100644 --- a/api/test/time_controller.cc +++ b/api/test/time_controller.cc @@ -31,7 +31,7 @@ bool TimeController::Wait(const std::function& done, // Step size is chosen to be short enough to not significantly affect latency // in real time tests while being long enough to avoid adding too much load to // the system. - const auto kStep = TimeDelta::ms(5); + const auto kStep = TimeDelta::Millis(5); for (auto elapsed = TimeDelta::Zero(); elapsed < max_duration; elapsed += kStep) { if (done()) diff --git a/api/test/time_controller.h b/api/test/time_controller.h index aa69c5200c..3276b4fbdd 100644 --- a/api/test/time_controller.h +++ b/api/test/time_controller.h @@ -59,7 +59,7 @@ class TimeController { // Waits until done() == true, polling done() in small time intervals. bool Wait(const std::function& done, - TimeDelta max_duration = TimeDelta::seconds(5)); + TimeDelta max_duration = TimeDelta::Seconds(5)); }; // Interface for telling time, scheduling an event to fire at a particular time, diff --git a/api/transport/goog_cc_factory.cc b/api/transport/goog_cc_factory.cc index ccadb8bc22..fd1189901f 100644 --- a/api/transport/goog_cc_factory.cc +++ b/api/transport/goog_cc_factory.cc @@ -53,7 +53,7 @@ GoogCcNetworkControllerFactory::Create(NetworkControllerConfig config) { TimeDelta GoogCcNetworkControllerFactory::GetProcessInterval() const { const int64_t kUpdateIntervalMs = 25; - return TimeDelta::ms(kUpdateIntervalMs); + return TimeDelta::Millis(kUpdateIntervalMs); } GoogCcFeedbackNetworkControllerFactory::GoogCcFeedbackNetworkControllerFactory( diff --git a/api/transport/test/feedback_generator_interface.h b/api/transport/test/feedback_generator_interface.h index cff67dd1df..bc95751c96 100644 --- a/api/transport/test/feedback_generator_interface.h +++ b/api/transport/test/feedback_generator_interface.h @@ -21,7 +21,7 @@ class FeedbackGenerator { struct Config { BuiltInNetworkBehaviorConfig send_link; BuiltInNetworkBehaviorConfig return_link; - TimeDelta feedback_interval = TimeDelta::ms(50); + TimeDelta feedback_interval = TimeDelta::Millis(50); DataSize feedback_packet_size = DataSize::bytes(20); }; virtual ~FeedbackGenerator() = default; diff --git a/api/units/data_rate.h b/api/units/data_rate.h index 78c2e0ed9a..949eceaf0f 100644 --- a/api/units/data_rate.h +++ b/api/units/data_rate.h @@ -106,7 +106,7 @@ inline constexpr DataRate operator/(const DataSize size, return DataRate::bps(data_rate_impl::Microbits(size) / duration.us()); } inline constexpr TimeDelta operator/(const DataSize size, const DataRate rate) { - return TimeDelta::us(data_rate_impl::Microbits(size) / rate.bps()); + return TimeDelta::Micros(data_rate_impl::Microbits(size) / rate.bps()); } inline constexpr DataSize operator*(const DataRate rate, const TimeDelta duration) { diff --git a/api/units/data_rate_unittest.cc b/api/units/data_rate_unittest.cc index d887107dea..7a3823c759 100644 --- a/api/units/data_rate_unittest.cc +++ b/api/units/data_rate_unittest.cc @@ -153,7 +153,7 @@ TEST(UnitConversionTest, DataRateAndDataSizeAndTimeDelta) { const int64_t kSeconds = 5; const int64_t kBitsPerSecond = 440; const int64_t kBytes = 44000; - const TimeDelta delta_a = TimeDelta::seconds(kSeconds); + const TimeDelta delta_a = TimeDelta::Seconds(kSeconds); const DataRate rate_b = DataRate::bps(kBitsPerSecond); const DataSize size_c = DataSize::bytes(kBytes); EXPECT_EQ((delta_a * rate_b).bytes(), kSeconds * kBitsPerSecond / 8); @@ -183,7 +183,7 @@ TEST(UnitConversionTest, DivisionFailsOnLargeSize) { std::numeric_limits::max() / 8000000; const DataSize large_size = DataSize::bytes(kJustSmallEnoughForDivision); const DataRate data_rate = DataRate::kbps(100); - const TimeDelta time_delta = TimeDelta::ms(100); + const TimeDelta time_delta = TimeDelta::Millis(100); EXPECT_TRUE((large_size / data_rate).IsFinite()); EXPECT_TRUE((large_size / time_delta).IsFinite()); #if GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) && RTC_DCHECK_IS_ON diff --git a/api/units/frequency.h b/api/units/frequency.h index 53bd7c902f..79b152bb49 100644 --- a/api/units/frequency.h +++ b/api/units/frequency.h @@ -76,7 +76,7 @@ inline constexpr TimeDelta operator/(int64_t nominator, RTC_DCHECK_LE(nominator, std::numeric_limits::max() / kMegaPerMilli); RTC_CHECK(frequency.IsFinite()); RTC_CHECK(!frequency.IsZero()); - return TimeDelta::us(nominator * kMegaPerMilli / frequency.millihertz()); + return TimeDelta::Micros(nominator * kMegaPerMilli / frequency.millihertz()); } inline constexpr double operator*(Frequency frequency, TimeDelta time_delta) { diff --git a/api/units/frequency_unittest.cc b/api/units/frequency_unittest.cc index 16a7e1bb85..8c0561fbfe 100644 --- a/api/units/frequency_unittest.cc +++ b/api/units/frequency_unittest.cc @@ -152,9 +152,9 @@ TEST(FrequencyTest, InfinityOperations) { } TEST(UnitConversionTest, TimeDeltaAndFrequency) { - EXPECT_EQ(1 / Frequency::hertz(50), TimeDelta::ms(20)); - EXPECT_EQ(1 / TimeDelta::ms(20), Frequency::hertz(50)); - EXPECT_EQ(Frequency::kHz(200) * TimeDelta::ms(2), 400.0); + EXPECT_EQ(1 / Frequency::hertz(50), TimeDelta::Millis(20)); + EXPECT_EQ(1 / TimeDelta::Millis(20), Frequency::hertz(50)); + EXPECT_EQ(Frequency::kHz(200) * TimeDelta::Millis(2), 400.0); } } // namespace test } // namespace webrtc diff --git a/api/units/time_delta.h b/api/units/time_delta.h index a53ffee74d..0d88f0ea72 100644 --- a/api/units/time_delta.h +++ b/api/units/time_delta.h @@ -107,7 +107,7 @@ class TimeDelta final : public rtc_units_impl::RelativeUnit { } constexpr TimeDelta Abs() const { - return us() < 0 ? TimeDelta::us(-us()) : *this; + return us() < 0 ? TimeDelta::Micros(-us()) : *this; } private: diff --git a/api/units/timestamp.h b/api/units/timestamp.h index f71edfc155..75a6ff88ef 100644 --- a/api/units/timestamp.h +++ b/api/units/timestamp.h @@ -109,7 +109,7 @@ class Timestamp final : public rtc_units_impl::UnitBase { RTC_DCHECK(!delta.IsPlusInfinity()); return MinusInfinity(); } - return Timestamp::us(us() + delta.us()); + return Timestamp::Micros(us() + delta.us()); } constexpr Timestamp operator-(const TimeDelta delta) const { if (IsPlusInfinity() || delta.IsMinusInfinity()) { @@ -121,7 +121,7 @@ class Timestamp final : public rtc_units_impl::UnitBase { RTC_DCHECK(!delta.IsMinusInfinity()); return MinusInfinity(); } - return Timestamp::us(us() - delta.us()); + return Timestamp::Micros(us() - delta.us()); } constexpr TimeDelta operator-(const Timestamp other) const { if (IsPlusInfinity() || other.IsMinusInfinity()) { @@ -133,7 +133,7 @@ class Timestamp final : public rtc_units_impl::UnitBase { RTC_DCHECK(!other.IsMinusInfinity()); return TimeDelta::MinusInfinity(); } - return TimeDelta::us(us() - other.us()); + return TimeDelta::Micros(us() - other.us()); } constexpr Timestamp& operator-=(const TimeDelta delta) { *this = *this - delta; diff --git a/api/video_codecs/test/video_encoder_software_fallback_wrapper_unittest.cc b/api/video_codecs/test/video_encoder_software_fallback_wrapper_unittest.cc index ba13d92b72..1fa62eb4c0 100644 --- a/api/video_codecs/test/video_encoder_software_fallback_wrapper_unittest.cc +++ b/api/video_codecs/test/video_encoder_software_fallback_wrapper_unittest.cc @@ -422,7 +422,7 @@ class ForcedFallbackTest : public VideoEncoderSoftwareFallbackWrapperTest { protected: void SetUp() override { - clock_.SetTime(Timestamp::us(1234)); + clock_.SetTime(Timestamp::Micros(1234)); ConfigureVp8Codec(); } diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc index 96dcf75875..17ab5d7e2b 100644 --- a/audio/audio_send_stream.cc +++ b/audio/audio_send_stream.cc @@ -802,7 +802,7 @@ void AudioSendStream::ConfigureBitrateObserver() { if (use_legacy_overhead_calculation_) { // OverheadPerPacket = Ipv4(20B) + UDP(8B) + SRTP(10B) + RTP(12) constexpr int kOverheadPerPacket = 20 + 8 + 10 + 12; - const TimeDelta kMinPacketDuration = TimeDelta::ms(20); + const TimeDelta kMinPacketDuration = TimeDelta::Millis(20); DataRate max_overhead = DataSize::bytes(kOverheadPerPacket) / kMinPacketDuration; priority_bitrate += max_overhead; @@ -858,7 +858,7 @@ AudioSendStream::GetMinMaxBitrateConstraints() const { // OverheadPerPacket = Ipv4(20B) + UDP(8B) + SRTP(10B) + RTP(12) const DataSize kOverheadPerPacket = DataSize::bytes(20 + 8 + 10 + 12); const TimeDelta kMaxFrameLength = - TimeDelta::ms(60); // Based on Opus spec + TimeDelta::Millis(60); // Based on Opus spec const DataRate kMinOverhead = kOverheadPerPacket / kMaxFrameLength; constraints.min += kMinOverhead; constraints.max += kMinOverhead; diff --git a/audio/audio_send_stream_unittest.cc b/audio/audio_send_stream_unittest.cc index 3b9fbb7f39..8600a679d1 100644 --- a/audio/audio_send_stream_unittest.cc +++ b/audio/audio_send_stream_unittest.cc @@ -83,8 +83,8 @@ const AudioCodecSpec kCodecSpecs[] = { // should be made more precise in the future. This can be changed when that // logic is more accurate. const DataSize kOverheadPerPacket = DataSize::bytes(20 + 8 + 10 + 12); -const TimeDelta kMinFrameLength = TimeDelta::ms(20); -const TimeDelta kMaxFrameLength = TimeDelta::ms(120); +const TimeDelta kMinFrameLength = TimeDelta::Millis(20); +const TimeDelta kMaxFrameLength = TimeDelta::Millis(120); const DataRate kMinOverheadRate = kOverheadPerPacket / kMaxFrameLength; const DataRate kMaxOverheadRate = kOverheadPerPacket / kMinFrameLength; @@ -108,7 +108,7 @@ std::unique_ptr SetupAudioEncoderMock( .WillByDefault(Return(spec.format.clockrate_hz)); ON_CALL(*encoder.get(), GetFrameLengthRange()) .WillByDefault(Return(absl::optional>{ - {TimeDelta::ms(20), TimeDelta::ms(120)}})); + {TimeDelta::Millis(20), TimeDelta::Millis(120)}})); return encoder; } } @@ -555,8 +555,8 @@ TEST(AudioSendStreamTest, DoesNotPassHigherBitrateThanMaxBitrate) { BitrateAllocationUpdate update; update.target_bitrate = DataRate::bps(helper.config().max_bitrate_bps + 5000); update.packet_loss_ratio = 0; - update.round_trip_time = TimeDelta::ms(50); - update.bwe_period = TimeDelta::ms(6000); + update.round_trip_time = TimeDelta::Millis(50); + update.bwe_period = TimeDelta::Millis(6000); helper.worker()->SendTask([&] { send_stream->OnBitrateUpdated(update); }, RTC_FROM_HERE); } @@ -673,12 +673,12 @@ TEST(AudioSendStreamTest, ProbingIntervalOnBitrateUpdated) { EXPECT_CALL(*helper.channel_send(), OnBitrateAllocation(Field(&BitrateAllocationUpdate::bwe_period, - Eq(TimeDelta::ms(5000))))); + Eq(TimeDelta::Millis(5000))))); BitrateAllocationUpdate update; update.target_bitrate = DataRate::bps(helper.config().max_bitrate_bps + 5000); update.packet_loss_ratio = 0; - update.round_trip_time = TimeDelta::ms(50); - update.bwe_period = TimeDelta::ms(5000); + update.round_trip_time = TimeDelta::Millis(50); + update.bwe_period = TimeDelta::Millis(5000); helper.worker()->SendTask([&] { send_stream->OnBitrateUpdated(update); }, RTC_FROM_HERE); } diff --git a/audio/test/pc_low_bandwidth_audio_test.cc b/audio/test/pc_low_bandwidth_audio_test.cc index e372fabc72..ed052c03f7 100644 --- a/audio/test/pc_low_bandwidth_audio_test.cc +++ b/audio/test/pc_low_bandwidth_audio_test.cc @@ -140,7 +140,7 @@ TEST(PCLowBandwidthAudioTest, PCGoodNetworkHighBitrate) { alice->SetAudioConfig(std::move(audio)); }, [](PeerConfigurer* bob) {}); - fixture->Run(RunParams(TimeDelta::ms( + fixture->Run(RunParams(TimeDelta::Millis( absl::GetFlag(FLAGS_quick) ? kQuickTestDurationMs : kTestDurationMs))); LogTestResults(); } @@ -166,7 +166,7 @@ TEST(PCLowBandwidthAudioTest, PC40kbpsNetwork) { alice->SetAudioConfig(std::move(audio)); }, [](PeerConfigurer* bob) {}); - fixture->Run(RunParams(TimeDelta::ms( + fixture->Run(RunParams(TimeDelta::Millis( absl::GetFlag(FLAGS_quick) ? kQuickTestDurationMs : kTestDurationMs))); LogTestResults(); } diff --git a/call/bitrate_allocator.cc b/call/bitrate_allocator.cc index 6880422336..681b1005dc 100644 --- a/call/bitrate_allocator.cc +++ b/call/bitrate_allocator.cc @@ -407,8 +407,8 @@ void BitrateAllocator::OnNetworkEstimateChanged(TargetTransferRate msg) { update.target_bitrate = DataRate::bps(allocated_bitrate); update.stable_target_bitrate = DataRate::bps(allocated_stable_target_rate); update.packet_loss_ratio = last_fraction_loss_ / 256.0; - update.round_trip_time = TimeDelta::ms(last_rtt_); - update.bwe_period = TimeDelta::ms(last_bwe_period_ms_); + update.round_trip_time = TimeDelta::Millis(last_rtt_); + update.bwe_period = TimeDelta::Millis(last_bwe_period_ms_); update.cwnd_reduce_ratio = msg.cwnd_reduce_ratio; uint32_t protection_bitrate = config.observer->OnBitrateUpdated(update); @@ -472,8 +472,8 @@ void BitrateAllocator::AddObserver(BitrateAllocatorObserver* observer, update.target_bitrate = DataRate::bps(allocated_bitrate); update.stable_target_bitrate = DataRate::bps(allocated_stable_bitrate); update.packet_loss_ratio = last_fraction_loss_ / 256.0; - update.round_trip_time = TimeDelta::ms(last_rtt_); - update.bwe_period = TimeDelta::ms(last_bwe_period_ms_); + update.round_trip_time = TimeDelta::Millis(last_rtt_); + update.bwe_period = TimeDelta::Millis(last_bwe_period_ms_); uint32_t protection_bitrate = config.observer->OnBitrateUpdated(update); config.allocated_bitrate_bps = allocated_bitrate; if (allocated_bitrate > 0) @@ -488,8 +488,8 @@ void BitrateAllocator::AddObserver(BitrateAllocatorObserver* observer, update.target_bitrate = DataRate::Zero(); update.stable_target_bitrate = DataRate::Zero(); update.packet_loss_ratio = last_fraction_loss_ / 256.0; - update.round_trip_time = TimeDelta::ms(last_rtt_); - update.bwe_period = TimeDelta::ms(last_bwe_period_ms_); + update.round_trip_time = TimeDelta::Millis(last_rtt_); + update.bwe_period = TimeDelta::Millis(last_bwe_period_ms_); observer->OnBitrateUpdated(update); } UpdateAllocationLimits(); diff --git a/call/bitrate_allocator_unittest.cc b/call/bitrate_allocator_unittest.cc index edb3f7e30e..e15f913f6c 100644 --- a/call/bitrate_allocator_unittest.cc +++ b/call/bitrate_allocator_unittest.cc @@ -88,13 +88,13 @@ TargetTransferRate CreateTargetRateMessage(uint32_t target_bitrate_bps, TargetTransferRate msg; // The timestamp is just for log output, keeping it fixed just means fewer log // messages in the test. - msg.at_time = Timestamp::seconds(10000); + msg.at_time = Timestamp::Seconds(10000); msg.target_rate = DataRate::bps(target_bitrate_bps); msg.stable_target_rate = msg.target_rate; msg.network_estimate.bandwidth = msg.target_rate; msg.network_estimate.loss_rate_ratio = fraction_loss / 255.0; - msg.network_estimate.round_trip_time = TimeDelta::ms(rtt_ms); - msg.network_estimate.bwe_period = TimeDelta::ms(bwe_period_ms); + msg.network_estimate.round_trip_time = TimeDelta::Millis(rtt_ms); + msg.network_estimate.bwe_period = TimeDelta::Millis(bwe_period_ms); return msg; } } // namespace diff --git a/call/call.cc b/call/call.cc index e2d896249c..880c4bbbb5 100644 --- a/call/call.cc +++ b/call/call.cc @@ -1352,7 +1352,7 @@ void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, ReceivedPacket packet_msg; packet_msg.size = DataSize::bytes(packet.payload_size()); - packet_msg.receive_time = Timestamp::ms(packet.arrival_time_ms()); + packet_msg.receive_time = Timestamp::Millis(packet.arrival_time_ms()); if (header.extension.hasAbsoluteSendTime) { packet_msg.send_time = header.extension.GetAbsoluteSendTimestamp(); } diff --git a/call/rampup_tests.cc b/call/rampup_tests.cc index 0377126821..64eab050cb 100644 --- a/call/rampup_tests.cc +++ b/call/rampup_tests.cc @@ -38,7 +38,7 @@ ABSL_FLAG(std::string, namespace webrtc { namespace { -constexpr TimeDelta kPollInterval = TimeDelta::Millis<20>(); +constexpr TimeDelta kPollInterval = TimeDelta::Millis(20); static const int kExpectedHighVideoBitrateBps = 80000; static const int kExpectedHighAudioBitrateBps = 30000; static const int kLowBandwidthLimitBps = 20000; diff --git a/call/receive_time_calculator.cc b/call/receive_time_calculator.cc index 0675de0aa7..94d1fd18cc 100644 --- a/call/receive_time_calculator.cc +++ b/call/receive_time_calculator.cc @@ -26,10 +26,10 @@ const char kBweReceiveTimeCorrection[] = "WebRTC-Bwe-ReceiveTimeFix"; } // namespace ReceiveTimeCalculatorConfig::ReceiveTimeCalculatorConfig() - : max_packet_time_repair("maxrep", TimeDelta::ms(2000)), - stall_threshold("stall", TimeDelta::ms(5)), - tolerance("tol", TimeDelta::ms(1)), - max_stall("maxstall", TimeDelta::seconds(5)) { + : max_packet_time_repair("maxrep", TimeDelta::Millis(2000)), + stall_threshold("stall", TimeDelta::Millis(5)), + tolerance("tol", TimeDelta::Millis(1)), + max_stall("maxstall", TimeDelta::Seconds(5)) { std::string trial_string = field_trial::FindFullName(kBweReceiveTimeCorrection); ParseFieldTrial( diff --git a/call/rtp_transport_controller_send.cc b/call/rtp_transport_controller_send.cc index 20f3a996e5..6d66c3a3bb 100644 --- a/call/rtp_transport_controller_send.cc +++ b/call/rtp_transport_controller_send.cc @@ -32,14 +32,14 @@ namespace { static const int64_t kRetransmitWindowSizeMs = 500; static const size_t kMaxOverheadBytes = 500; -constexpr TimeDelta kPacerQueueUpdateInterval = TimeDelta::Millis<25>(); +constexpr TimeDelta kPacerQueueUpdateInterval = TimeDelta::Millis(25); TargetRateConstraints ConvertConstraints(int min_bitrate_bps, int max_bitrate_bps, int start_bitrate_bps, Clock* clock) { TargetRateConstraints msg; - msg.at_time = Timestamp::ms(clock->TimeInMilliseconds()); + msg.at_time = Timestamp::Millis(clock->TimeInMilliseconds()); msg.min_data_rate = min_bitrate_bps >= 0 ? DataRate::bps(min_bitrate_bps) : DataRate::Zero(); msg.max_data_rate = max_bitrate_bps > 0 ? DataRate::bps(max_bitrate_bps) @@ -96,7 +96,7 @@ RtpTransportControllerSend::RtpTransportControllerSend( controller_factory_fallback_( std::make_unique(predictor_factory)), process_interval_(controller_factory_fallback_->GetProcessInterval()), - last_report_block_time_(Timestamp::ms(clock_->TimeInMilliseconds())), + last_report_block_time_(Timestamp::Millis(clock_->TimeInMilliseconds())), reset_feedback_on_route_change_( !IsEnabled(trials, "WebRTC-Bwe-NoFeedbackReset")), send_side_bwe_with_overhead_( @@ -225,7 +225,7 @@ void RtpTransportControllerSend::SetPacingFactor(float pacing_factor) { UpdateStreamsConfig(); } void RtpTransportControllerSend::SetQueueTimeLimit(int limit_ms) { - pacer()->SetQueueTimeLimit(TimeDelta::ms(limit_ms)); + pacer()->SetQueueTimeLimit(TimeDelta::Millis(limit_ms)); } StreamFeedbackProvider* RtpTransportControllerSend::GetStreamFeedbackProvider() { @@ -284,7 +284,7 @@ void RtpTransportControllerSend::OnNetworkRouteChanged( network_route.connected, network_route.packet_overhead)); } NetworkRouteChange msg; - msg.at_time = Timestamp::ms(clock_->TimeInMilliseconds()); + msg.at_time = Timestamp::Millis(clock_->TimeInMilliseconds()); msg.constraints = ConvertConstraints(bitrate_config, clock_); task_queue_.PostTask([this, msg, network_route] { RTC_DCHECK_RUN_ON(&task_queue_); @@ -306,7 +306,7 @@ void RtpTransportControllerSend::OnNetworkAvailability(bool network_available) { RTC_LOG(LS_VERBOSE) << "SignalNetworkState " << (network_available ? "Up" : "Down"); NetworkAvailability msg; - msg.at_time = Timestamp::ms(clock_->TimeInMilliseconds()); + msg.at_time = Timestamp::Millis(clock_->TimeInMilliseconds()); msg.network_available = network_available; task_queue_.PostTask([this, msg]() { RTC_DCHECK_RUN_ON(&task_queue_); @@ -443,7 +443,7 @@ void RtpTransportControllerSend::IncludeOverheadInPacedSender() { void RtpTransportControllerSend::OnReceivedEstimatedBitrate(uint32_t bitrate) { RemoteBitrateReport msg; - msg.receive_time = Timestamp::ms(clock_->TimeInMilliseconds()); + msg.receive_time = Timestamp::Millis(clock_->TimeInMilliseconds()); msg.bandwidth = DataRate::bps(bitrate); task_queue_.PostTask([this, msg]() { RTC_DCHECK_RUN_ON(&task_queue_); @@ -464,8 +464,8 @@ void RtpTransportControllerSend::OnReceivedRtcpReceiverReport( task_queue_.PostTask([this, now_ms, rtt_ms]() { RTC_DCHECK_RUN_ON(&task_queue_); RoundTripTimeUpdate report; - report.receive_time = Timestamp::ms(now_ms); - report.round_trip_time = TimeDelta::ms(rtt_ms); + report.receive_time = Timestamp::Millis(now_ms); + report.round_trip_time = TimeDelta::Millis(rtt_ms); report.smoothed = false; if (controller_ && !report.round_trip_time.IsZero()) PostUpdates(controller_->OnRoundTripTimeUpdate(report)); @@ -476,7 +476,7 @@ void RtpTransportControllerSend::OnAddPacket( const RtpPacketSendInfo& packet_info) { feedback_demuxer_.AddPacket(packet_info); - Timestamp creation_time = Timestamp::ms(clock_->TimeInMilliseconds()); + Timestamp creation_time = Timestamp::Millis(clock_->TimeInMilliseconds()); task_queue_.PostTask([this, packet_info, creation_time]() { RTC_DCHECK_RUN_ON(&task_queue_); transport_feedback_adapter_.AddPacket( @@ -489,7 +489,7 @@ void RtpTransportControllerSend::OnAddPacket( void RtpTransportControllerSend::OnTransportFeedback( const rtcp::TransportFeedback& feedback) { feedback_demuxer_.OnTransportFeedback(feedback); - auto feedback_time = Timestamp::ms(clock_->TimeInMilliseconds()); + auto feedback_time = Timestamp::Millis(clock_->TimeInMilliseconds()); task_queue_.PostTask([this, feedback, feedback_time]() { RTC_DCHECK_RUN_ON(&task_queue_); absl::optional feedback_msg = @@ -509,7 +509,7 @@ void RtpTransportControllerSend::OnRemoteNetworkEstimate( event_log_->Log(std::make_unique( estimate.link_capacity_lower, estimate.link_capacity_upper)); } - estimate.update_time = Timestamp::ms(clock_->TimeInMilliseconds()); + estimate.update_time = Timestamp::Millis(clock_->TimeInMilliseconds()); task_queue_.PostTask([this, estimate] { RTC_DCHECK_RUN_ON(&task_queue_); if (controller_) @@ -526,7 +526,7 @@ void RtpTransportControllerSend::MaybeCreateControllers() { control_handler_ = std::make_unique(); initial_config_.constraints.at_time = - Timestamp::ms(clock_->TimeInMilliseconds()); + Timestamp::Millis(clock_->TimeInMilliseconds()); initial_config_.stream_based_config = streams_config_; // TODO(srte): Use fallback controller if no feedback is available. @@ -576,14 +576,14 @@ void RtpTransportControllerSend::StartProcessPeriodicTasks() { void RtpTransportControllerSend::UpdateControllerWithTimeInterval() { RTC_DCHECK(controller_); ProcessInterval msg; - msg.at_time = Timestamp::ms(clock_->TimeInMilliseconds()); + msg.at_time = Timestamp::Millis(clock_->TimeInMilliseconds()); if (add_pacing_to_cwin_) msg.pacer_queue = pacer()->QueueSizeData(); PostUpdates(controller_->OnProcessInterval(msg)); } void RtpTransportControllerSend::UpdateStreamsConfig() { - streams_config_.at_time = Timestamp::ms(clock_->TimeInMilliseconds()); + streams_config_.at_time = Timestamp::Millis(clock_->TimeInMilliseconds()); if (controller_) PostUpdates(controller_->OnStreamsConfig(streams_config_)); } @@ -637,7 +637,7 @@ void RtpTransportControllerSend::OnReceivedRtcpReceiverReportBlocks( if (packets_received_delta < 1) return; - Timestamp now = Timestamp::ms(now_ms); + Timestamp now = Timestamp::Millis(now_ms); TransportLossReport msg; msg.packets_lost_delta = total_packets_lost_delta; msg.packets_received_delta = packets_received_delta; diff --git a/call/rtp_video_sender_unittest.cc b/call/rtp_video_sender_unittest.cc index 7935fac389..0289ec0bb9 100644 --- a/call/rtp_video_sender_unittest.cc +++ b/call/rtp_video_sender_unittest.cc @@ -116,7 +116,7 @@ class RtpVideoSenderTestFixture { int payload_type, const std::map& suspended_payload_states, FrameCountObserver* frame_count_observer) - : time_controller_(Timestamp::ms(1000000)), + : time_controller_(Timestamp::Millis(1000000)), config_(CreateVideoSendStreamConfig(&transport_, ssrcs, rtx_ssrcs, @@ -433,7 +433,7 @@ TEST(RtpVideoSenderTest, DoesNotRetrasmitAckedPackets) { EncodedImageCallback::Result::OK, test.router()->OnEncodedImage(encoded_image, nullptr, nullptr).error); - test.AdvanceTime(TimeDelta::ms(33)); + test.AdvanceTime(TimeDelta::Millis(33)); ASSERT_TRUE(event.Wait(kTimeoutMs)); @@ -462,7 +462,7 @@ TEST(RtpVideoSenderTest, DoesNotRetrasmitAckedPackets) { return true; }); test.router()->DeliverRtcp(nack_buffer.data(), nack_buffer.size()); - test.AdvanceTime(TimeDelta::ms(33)); + test.AdvanceTime(TimeDelta::Millis(33)); ASSERT_TRUE(event.Wait(kTimeoutMs)); // Verify that both packets were retransmitted. @@ -488,7 +488,7 @@ TEST(RtpVideoSenderTest, DoesNotRetrasmitAckedPackets) { // the history has been notified of the ack and removed the packet. The // second packet, included in the feedback but not marked as received, should // still be retransmitted. - test.AdvanceTime(TimeDelta::ms(33)); + test.AdvanceTime(TimeDelta::Millis(33)); EXPECT_CALL(test.transport(), SendRtp) .WillOnce([&event, &lost_packet_feedback](const uint8_t* packet, size_t length, @@ -504,7 +504,7 @@ TEST(RtpVideoSenderTest, DoesNotRetrasmitAckedPackets) { return true; }); test.router()->DeliverRtcp(nack_buffer.data(), nack_buffer.size()); - test.AdvanceTime(TimeDelta::ms(33)); + test.AdvanceTime(TimeDelta::Millis(33)); ASSERT_TRUE(event.Wait(kTimeoutMs)); } @@ -551,10 +551,10 @@ TEST(RtpVideoSenderTest, RetransmitsOnTransportWideLossInfo) { // Run for a short duration and reset counters to avoid counting RTX packets // from initial probing. - s.RunFor(TimeDelta::seconds(1)); + s.RunFor(TimeDelta::Seconds(1)); rtx_packets = 0; int decoded_baseline = lossy->receive()->GetStats().frames_decoded; - s.RunFor(TimeDelta::seconds(1)); + s.RunFor(TimeDelta::Seconds(1)); // We expect both that RTX packets were sent and that an appropriate number of // frames were received. This is somewhat redundant but reduces the risk of // false positives in future regressions (e.g. RTX is send due to probing). @@ -608,7 +608,7 @@ TEST(RtpVideoSenderTest, EarlyRetransmits) { .error, EncodedImageCallback::Result::OK); - test.AdvanceTime(TimeDelta::ms(33)); + test.AdvanceTime(TimeDelta::Millis(33)); ASSERT_TRUE(event.Wait(kTimeoutMs)); uint16_t frame2_rtp_sequence_number = 0; @@ -631,7 +631,7 @@ TEST(RtpVideoSenderTest, EarlyRetransmits) { ->OnEncodedImage(encoded_image, &codec_specific, nullptr) .error, EncodedImageCallback::Result::OK); - test.AdvanceTime(TimeDelta::ms(33)); + test.AdvanceTime(TimeDelta::Millis(33)); ASSERT_TRUE(event.Wait(kTimeoutMs)); EXPECT_NE(frame1_transport_sequence_number, frame2_transport_sequence_number); @@ -669,7 +669,7 @@ TEST(RtpVideoSenderTest, EarlyRetransmits) { {first_packet_feedback, second_packet_feedback}); // Wait for pacer to run and send the RTX packet. - test.AdvanceTime(TimeDelta::ms(33)); + test.AdvanceTime(TimeDelta::Millis(33)); ASSERT_TRUE(event.Wait(kTimeoutMs)); } diff --git a/call/simulated_network.cc b/call/simulated_network.cc index f90446480b..200d5ed8f7 100644 --- a/call/simulated_network.cc +++ b/call/simulated_network.cc @@ -21,7 +21,7 @@ namespace webrtc { namespace { -constexpr TimeDelta kDefaultProcessDelay = TimeDelta::Millis<5>(); +constexpr TimeDelta kDefaultProcessDelay = TimeDelta::Millis(5); } // namespace CoDelSimulation::CoDelSimulation() = default; @@ -31,9 +31,9 @@ bool CoDelSimulation::DropDequeuedPacket(Timestamp now, Timestamp enqueing_time, DataSize packet_size, DataSize queue_size) { - constexpr TimeDelta kWindow = TimeDelta::Millis<100>(); - constexpr TimeDelta kDelayThreshold = TimeDelta::Millis<5>(); - constexpr TimeDelta kDropCountMemory = TimeDelta::Millis<1600>(); + constexpr TimeDelta kWindow = TimeDelta::Millis(100); + constexpr TimeDelta kDelayThreshold = TimeDelta::Millis(5); + constexpr TimeDelta kDropCountMemory = TimeDelta::Millis(1600); constexpr DataSize kMaxPacketSize = DataSize::Bytes<1500>(); // Compensates for process interval in simulation; not part of standard CoDel. @@ -191,8 +191,8 @@ void SimulatedNetwork::UpdateCapacityQueue(ConfigState state, if (state.config.codel_active_queue_management) { while (!capacity_link_.empty() && codel_controller_.DropDequeuedPacket( - Timestamp::us(time_us), - Timestamp::us(capacity_link_.front().packet.send_time_us), + Timestamp::Micros(time_us), + Timestamp::Micros(capacity_link_.front().packet.send_time_us), DataSize::bytes(capacity_link_.front().packet.size), DataSize::bytes(queue_size_bytes_))) { PacketInfo dropped = capacity_link_.front(); diff --git a/call/simulated_network_unittest.cc b/call/simulated_network_unittest.cc index 25fb1c1399..0d098f7f49 100644 --- a/call/simulated_network_unittest.cc +++ b/call/simulated_network_unittest.cc @@ -24,7 +24,7 @@ constexpr int kNotReceived = PacketDeliveryInfo::kNotReceived; } TEST(SimulatedNetworkTest, CodelDoesNothingAtCapacity) { - const TimeDelta kRuntime = TimeDelta::seconds(30); + const TimeDelta kRuntime = TimeDelta::Seconds(30); DataRate link_capacity = DataRate::kbps(1000); const DataSize packet_size = DataSize::bytes(1000); @@ -37,10 +37,10 @@ TEST(SimulatedNetworkTest, CodelDoesNothingAtCapacity) { // Need to round up here as otherwise we actually will choke. const TimeDelta packet_inverval = - packet_size / link_capacity + TimeDelta::ms(1); + packet_size / link_capacity + TimeDelta::Millis(1); // Send at capacity and see we get no loss. - Timestamp start_time = Timestamp::ms(0); + Timestamp start_time = Timestamp::Millis(0); Timestamp current_time = start_time; Timestamp next_packet_time = start_time; uint64_t next_id = 0; @@ -56,7 +56,7 @@ TEST(SimulatedNetworkTest, CodelDoesNothingAtCapacity) { } Timestamp next_delivery = Timestamp::PlusInfinity(); if (network.NextDeliveryTimeUs()) - next_delivery = Timestamp::us(*network.NextDeliveryTimeUs()); + next_delivery = Timestamp::Micros(*network.NextDeliveryTimeUs()); current_time = std::min(next_packet_time, next_delivery); if (current_time >= next_delivery) { for (PacketDeliveryInfo packet : @@ -77,8 +77,8 @@ TEST(SimulatedNetworkTest, CodelDoesNothingAtCapacity) { } TEST(SimulatedNetworkTest, CodelLimitsDelayAndDropsPacketsOnOverload) { - const TimeDelta kRuntime = TimeDelta::seconds(30); - const TimeDelta kCheckInterval = TimeDelta::ms(2000); + const TimeDelta kRuntime = TimeDelta::Seconds(30); + const TimeDelta kCheckInterval = TimeDelta::Millis(2000); DataRate link_capacity = DataRate::kbps(1000); const DataSize rough_packet_size = DataSize::bytes(1500); @@ -94,7 +94,7 @@ TEST(SimulatedNetworkTest, CodelLimitsDelayAndDropsPacketsOnOverload) { const DataSize packet_size = overload_rate * link_capacity * packet_inverval; // Send above capacity and see delays are still controlled at the cost of // packet loss. - Timestamp start_time = Timestamp::ms(0); + Timestamp start_time = Timestamp::Millis(0); Timestamp current_time = start_time; Timestamp next_packet_time = start_time; Timestamp last_check = start_time; @@ -113,7 +113,7 @@ TEST(SimulatedNetworkTest, CodelLimitsDelayAndDropsPacketsOnOverload) { } Timestamp next_delivery = Timestamp::PlusInfinity(); if (network.NextDeliveryTimeUs()) - next_delivery = Timestamp::us(*network.NextDeliveryTimeUs()); + next_delivery = Timestamp::Micros(*network.NextDeliveryTimeUs()); current_time = std::min(next_packet_time, next_delivery); if (current_time >= next_delivery) { for (PacketDeliveryInfo packet : @@ -130,7 +130,8 @@ TEST(SimulatedNetworkTest, CodelLimitsDelayAndDropsPacketsOnOverload) { if (current_time > last_check + kCheckInterval) { last_check = current_time; TimeDelta average_delay = - TimeDelta::us(absl::c_accumulate(delays_us, 0)) / delays_us.size(); + TimeDelta::Micros(absl::c_accumulate(delays_us, 0)) / + delays_us.size(); double loss_ratio = static_cast(lost) / (lost + delays_us.size()); EXPECT_LT(average_delay.ms(), 200) << "Time " << (current_time - start_time).ms() << "\n"; diff --git a/common_audio/smoothing_filter_unittest.cc b/common_audio/smoothing_filter_unittest.cc index 8b311d1498..80230922fe 100644 --- a/common_audio/smoothing_filter_unittest.cc +++ b/common_audio/smoothing_filter_unittest.cc @@ -26,7 +26,7 @@ constexpr int64_t kClockInitialTime = 123456; struct SmoothingFilterStates { explicit SmoothingFilterStates(int init_time_ms) : smoothing_filter(init_time_ms) { - fake_clock.AdvanceTime(TimeDelta::ms(kClockInitialTime)); + fake_clock.AdvanceTime(TimeDelta::Millis(kClockInitialTime)); } rtc::ScopedFakeClock fake_clock; SmoothingFilterImpl smoothing_filter; @@ -42,7 +42,7 @@ void CheckOutput(SmoothingFilterStates* states, int advance_time_ms, float expected_ouput) { states->smoothing_filter.AddSample(sample); - states->fake_clock.AdvanceTime(TimeDelta::ms(advance_time_ms)); + states->fake_clock.AdvanceTime(TimeDelta::Millis(advance_time_ms)); auto output = states->smoothing_filter.GetAverage(); EXPECT_TRUE(output); EXPECT_NEAR(expected_ouput, *output, kMaxAbsError); @@ -142,14 +142,14 @@ TEST(SmoothingFilterTest, CannotChangeTimeConstantDuringInitialization) { states.smoothing_filter.AddSample(0.0); // During initialization, |SetTimeConstantMs| does not take effect. - states.fake_clock.AdvanceTime(TimeDelta::ms(kInitTimeMs - 1)); + states.fake_clock.AdvanceTime(TimeDelta::Millis(kInitTimeMs - 1)); states.smoothing_filter.AddSample(0.0); EXPECT_FALSE(states.smoothing_filter.SetTimeConstantMs(kInitTimeMs * 2)); EXPECT_NE(std::exp(-1.0f / (kInitTimeMs * 2)), states.smoothing_filter.alpha()); - states.fake_clock.AdvanceTime(TimeDelta::ms(1)); + states.fake_clock.AdvanceTime(TimeDelta::Millis(1)); states.smoothing_filter.AddSample(0.0); // When initialization finishes, the time constant should be come // |kInitTimeConstantMs|. diff --git a/common_video/bitrate_adjuster_unittest.cc b/common_video/bitrate_adjuster_unittest.cc index eae15cd078..995aac1c27 100644 --- a/common_video/bitrate_adjuster_unittest.cc +++ b/common_video/bitrate_adjuster_unittest.cc @@ -34,7 +34,7 @@ class BitrateAdjusterTest : public ::testing::Test { const size_t frame_size_bytes = (bitrate_bps * frame_interval_ms) / (8 * 1000); for (size_t i = 0; i < update_frame_interval; ++i) { - clock_.AdvanceTime(webrtc::TimeDelta::ms(frame_interval_ms)); + clock_.AdvanceTime(webrtc::TimeDelta::Millis(frame_interval_ms)); adjuster_.Update(frame_size_bytes); } } diff --git a/common_video/frame_rate_estimator.cc b/common_video/frame_rate_estimator.cc index 86f07228e7..4c5a341ac0 100644 --- a/common_video/frame_rate_estimator.cc +++ b/common_video/frame_rate_estimator.cc @@ -27,7 +27,7 @@ absl::optional FrameRateEstimator::GetAverageFps() const { return absl::nullopt; } TimeDelta time_span = frame_times_.back() - frame_times_.front(); - if (time_span < TimeDelta::us(1)) { + if (time_span < TimeDelta::Micros(1)) { return absl::nullopt; } TimeDelta avg_frame_interval = time_span / (frame_times_.size() - 1); diff --git a/common_video/frame_rate_estimator_unittest.cc b/common_video/frame_rate_estimator_unittest.cc index 9058bac414..d11a7d4140 100644 --- a/common_video/frame_rate_estimator_unittest.cc +++ b/common_video/frame_rate_estimator_unittest.cc @@ -16,7 +16,7 @@ namespace webrtc { namespace { -constexpr TimeDelta kDefaultWindow = TimeDelta::Millis<1000>(); +constexpr TimeDelta kDefaultWindow = TimeDelta::Millis(1000); } class FrameRateEstimatorTest : public ::testing::Test { @@ -32,7 +32,7 @@ TEST_F(FrameRateEstimatorTest, NoEstimateWithLessThanTwoFrames) { EXPECT_FALSE(estimator_.GetAverageFps()); estimator_.OnFrame(clock_.CurrentTime()); EXPECT_FALSE(estimator_.GetAverageFps()); - clock_.AdvanceTime(TimeDelta::ms(33)); + clock_.AdvanceTime(TimeDelta::Millis(33)); EXPECT_FALSE(estimator_.GetAverageFps()); } @@ -46,7 +46,7 @@ TEST_F(FrameRateEstimatorTest, NoEstimateWithZeroSpan) { TEST_F(FrameRateEstimatorTest, SingleSpanFps) { const double kExpectedFps = 30.0; estimator_.OnFrame(clock_.CurrentTime()); - clock_.AdvanceTime(TimeDelta::seconds(1) / kExpectedFps); + clock_.AdvanceTime(TimeDelta::Seconds(1) / kExpectedFps); estimator_.OnFrame(clock_.CurrentTime()); EXPECT_NEAR(*estimator_.GetAverageFps(), kExpectedFps, 0.001); } @@ -61,11 +61,11 @@ TEST_F(FrameRateEstimatorTest, AverageFps) { const Timestamp start_time = clock_.CurrentTime(); while (clock_.CurrentTime() - start_time < kDefaultWindow / 2) { estimator_.OnFrame(clock_.CurrentTime()); - clock_.AdvanceTime(TimeDelta::seconds(1) / kLowFps); + clock_.AdvanceTime(TimeDelta::Seconds(1) / kLowFps); } while (clock_.CurrentTime() - start_time < kDefaultWindow) { estimator_.OnFrame(clock_.CurrentTime()); - clock_.AdvanceTime(TimeDelta::seconds(1) / kHighFps); + clock_.AdvanceTime(TimeDelta::Seconds(1) / kHighFps); } EXPECT_NEAR(*estimator_.GetAverageFps(), kExpectedFps, 0.001); @@ -81,13 +81,13 @@ TEST_F(FrameRateEstimatorTest, CullsOldFramesFromAveragingWindow) { // Oldest frame should just be pushed out the window, leaving a single frame // => no estimate possible. - clock_.AdvanceTime(TimeDelta::us(1)); + clock_.AdvanceTime(TimeDelta::Micros(1)); EXPECT_FALSE(estimator_.GetAverageFps(clock_.CurrentTime())); } TEST_F(FrameRateEstimatorTest, Reset) { estimator_.OnFrame(clock_.CurrentTime()); - clock_.AdvanceTime(TimeDelta::seconds(1) / 30); + clock_.AdvanceTime(TimeDelta::Seconds(1) / 30); estimator_.OnFrame(clock_.CurrentTime()); EXPECT_TRUE(estimator_.GetAverageFps()); @@ -95,7 +95,7 @@ TEST_F(FrameRateEstimatorTest, Reset) { // new frame. estimator_.Reset(); EXPECT_FALSE(estimator_.GetAverageFps()); - clock_.AdvanceTime(TimeDelta::seconds(1) / 30); + clock_.AdvanceTime(TimeDelta::Seconds(1) / 30); estimator_.OnFrame(clock_.CurrentTime()); EXPECT_FALSE(estimator_.GetAverageFps()); } diff --git a/logging/rtc_event_log/encoder/rtc_event_log_encoder_unittest.cc b/logging/rtc_event_log/encoder/rtc_event_log_encoder_unittest.cc index c52e0c77ef..3059621690 100644 --- a/logging/rtc_event_log/encoder/rtc_event_log_encoder_unittest.cc +++ b/logging/rtc_event_log/encoder/rtc_event_log_encoder_unittest.cc @@ -784,7 +784,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpReceiverReport) { } rtc::ScopedFakeClock fake_clock; - fake_clock.SetTime(Timestamp::ms(prng_.Rand())); + fake_clock.SetTime(Timestamp::Millis(prng_.Rand())); for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events(event_count_); @@ -800,7 +800,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpReceiverReport) { history_.push_back( std::make_unique(buffer)); } - fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000))); + fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000))); } std::string encoded = @@ -823,7 +823,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpSenderReport) { } rtc::ScopedFakeClock fake_clock; - fake_clock.SetTime(Timestamp::ms(prng_.Rand())); + fake_clock.SetTime(Timestamp::Millis(prng_.Rand())); for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events(event_count_); @@ -839,7 +839,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpSenderReport) { history_.push_back( std::make_unique(buffer)); } - fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000))); + fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000))); } std::string encoded = @@ -862,7 +862,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpExtendedReports) { } rtc::ScopedFakeClock fake_clock; - fake_clock.SetTime(Timestamp::ms(prng_.Rand())); + fake_clock.SetTime(Timestamp::Millis(prng_.Rand())); for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events(event_count_); @@ -878,7 +878,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpExtendedReports) { history_.push_back( std::make_unique(buffer)); } - fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000))); + fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000))); } std::string encoded = @@ -901,7 +901,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpFir) { } rtc::ScopedFakeClock fake_clock; - fake_clock.SetTime(Timestamp::ms(prng_.Rand())); + fake_clock.SetTime(Timestamp::Millis(prng_.Rand())); for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events(event_count_); @@ -917,7 +917,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpFir) { history_.push_back( std::make_unique(buffer)); } - fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000))); + fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000))); } std::string encoded = @@ -939,7 +939,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPli) { } rtc::ScopedFakeClock fake_clock; - fake_clock.SetTime(Timestamp::ms(prng_.Rand())); + fake_clock.SetTime(Timestamp::Millis(prng_.Rand())); for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events(event_count_); @@ -955,7 +955,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPli) { history_.push_back( std::make_unique(buffer)); } - fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000))); + fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000))); } std::string encoded = @@ -977,7 +977,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpNack) { } rtc::ScopedFakeClock fake_clock; - fake_clock.SetTime(Timestamp::ms(prng_.Rand())); + fake_clock.SetTime(Timestamp::Millis(prng_.Rand())); for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events(event_count_); @@ -993,7 +993,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpNack) { history_.push_back( std::make_unique(buffer)); } - fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000))); + fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000))); } std::string encoded = @@ -1015,7 +1015,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpRemb) { } rtc::ScopedFakeClock fake_clock; - fake_clock.SetTime(Timestamp::ms(prng_.Rand())); + fake_clock.SetTime(Timestamp::Millis(prng_.Rand())); for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events(event_count_); @@ -1031,7 +1031,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpRemb) { history_.push_back( std::make_unique(buffer)); } - fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000))); + fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000))); } std::string encoded = @@ -1053,7 +1053,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpTransportFeedback) { } rtc::ScopedFakeClock fake_clock; - fake_clock.SetTime(Timestamp::ms(prng_.Rand())); + fake_clock.SetTime(Timestamp::Millis(prng_.Rand())); for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events; @@ -1070,7 +1070,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpTransportFeedback) { history_.push_back( std::make_unique(buffer)); } - fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000))); + fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000))); } std::string encoded = @@ -1094,7 +1094,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpLossNotification) { } rtc::ScopedFakeClock fake_clock; - fake_clock.SetTime(Timestamp::ms(prng_.Rand())); + fake_clock.SetTime(Timestamp::Millis(prng_.Rand())); for (auto direction : {kIncomingPacket, kOutgoingPacket}) { std::vector events; @@ -1111,7 +1111,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpLossNotification) { history_.push_back( std::make_unique(buffer)); } - fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000))); + fake_clock.AdvanceTime(TimeDelta::Millis(prng_.Rand(0, 1000))); } std::string encoded = diff --git a/logging/rtc_event_log/logged_events.cc b/logging/rtc_event_log/logged_events.cc index c5b5a46fb1..3cba8bab21 100644 --- a/logging/rtc_event_log/logged_events.cc +++ b/logging/rtc_event_log/logged_events.cc @@ -31,7 +31,7 @@ LoggedPacketInfo::LoggedPacketInfo(const LoggedRtpPacket& rtp, has_transport_seq_no ? rtp.header.extension.transportSequenceNumber : 0)), capture_time(capture_time), - log_packet_time(Timestamp::us(rtp.log_time_us())), + log_packet_time(Timestamp::Micros(rtp.log_time_us())), reported_send_time(rtp.header.extension.hasAbsoluteSendTime ? rtp.header.extension.GetAbsoluteSendTimestamp() : Timestamp::MinusInfinity()) {} diff --git a/logging/rtc_event_log/rtc_event_log_parser.cc b/logging/rtc_event_log/rtc_event_log_parser.cc index 9e0e6e5a50..6a8c64cd53 100644 --- a/logging/rtc_event_log/rtc_event_log_parser.cc +++ b/logging/rtc_event_log/rtc_event_log_parser.cc @@ -2034,7 +2034,7 @@ std::vector ParsedRtcEventLog::GetRouteChanges() if (candidate.type == IceCandidatePairConfigType::kSelected) { InferredRouteChangeEvent route; route.route_id = candidate.candidate_pair_id; - route.log_time = Timestamp::ms(candidate.log_time_ms()); + route.log_time = Timestamp::Millis(candidate.log_time_ms()); route.send_overhead = kUdpOverhead + kSrtpOverhead + kIpv4Overhead; if (candidate.remote_address_family == @@ -2083,7 +2083,7 @@ std::vector ParsedRtcEventLog::GetPacketInfos( // If we have a large time delta, it can be caused by a gap in logging, // therefore we don't want to match up sequence numbers as we might have had // a wraparound. - if (new_log_time - last_log_time > TimeDelta::seconds(30)) { + if (new_log_time - last_log_time > TimeDelta::Seconds(30)) { seq_num_unwrapper = SequenceNumberUnwrapper(); indices.clear(); } @@ -2092,7 +2092,7 @@ std::vector ParsedRtcEventLog::GetPacketInfos( }; auto rtp_handler = [&](const LoggedRtpPacket& rtp) { - advance_time(Timestamp::ms(rtp.log_time_ms())); + advance_time(Timestamp::Millis(rtp.log_time_ms())); MediaStreamInfo* stream = &streams[rtp.header.ssrc]; Timestamp capture_time = Timestamp::MinusInfinity(); if (!stream->rtx) { @@ -2107,7 +2107,7 @@ std::vector ParsedRtcEventLog::GetPacketInfos( kStartingCaptureTimeTicks + stream->unwrap_capture_ticks.Unwrap(rtp.header.timestamp); // TODO(srte): Use logged sample rate when it is added to the format. - capture_time = Timestamp::seconds( + capture_time = Timestamp::Seconds( capture_ticks / (stream->media_type == LoggedMediaType::kAudio ? 48000.0 : 90000.0)); } @@ -2135,7 +2135,7 @@ std::vector ParsedRtcEventLog::GetPacketInfos( auto feedback_handler = [&](const LoggedRtcpPacketTransportFeedback& logged_rtcp) { - auto log_feedback_time = Timestamp::ms(logged_rtcp.log_time_ms()); + auto log_feedback_time = Timestamp::Millis(logged_rtcp.log_time_ms()); advance_time(log_feedback_time); const auto& feedback = logged_rtcp.transport_feedback; // Add timestamp deltas to a local time base selected on first packet @@ -2144,7 +2144,7 @@ std::vector ParsedRtcEventLog::GetPacketInfos( if (!last_feedback_base_time_us) { feedback_base_time = log_feedback_time; } else { - feedback_base_time += TimeDelta::us( + feedback_base_time += TimeDelta::Micros( feedback.GetBaseDeltaUs(*last_feedback_base_time_us)); } last_feedback_base_time_us = feedback.GetBaseTimeUs(); @@ -2163,15 +2163,16 @@ std::vector ParsedRtcEventLog::GetPacketInfos( } LoggedPacketInfo* sent = &packets[it->second]; if (log_feedback_time - sent->log_packet_time > - TimeDelta::seconds(60)) { + TimeDelta::Seconds(60)) { RTC_LOG(LS_WARNING) << "Received very late feedback, possibly due to wraparound."; continue; } if (packet.received()) { - receive_timestamp += TimeDelta::us(packet.delta_us()); + receive_timestamp += TimeDelta::Micros(packet.delta_us()); if (sent->reported_recv_time.IsInfinite()) { - sent->reported_recv_time = Timestamp::ms(receive_timestamp.ms()); + sent->reported_recv_time = + Timestamp::Millis(receive_timestamp.ms()); sent->log_feedback_time = log_feedback_time; } } else { @@ -2246,12 +2247,12 @@ std::vector ParsedRtcEventLog::GetIceEvents() const { std::vector log_events; auto handle_check = [&](const LoggedIceCandidatePairEvent& check) { log_events.push_back(LoggedIceEvent{check.candidate_pair_id, - Timestamp::ms(check.log_time_ms()), + Timestamp::Millis(check.log_time_ms()), check_map[check.type]}); }; auto handle_config = [&](const LoggedIceCandidatePairConfig& conf) { log_events.push_back(LoggedIceEvent{conf.candidate_pair_id, - Timestamp::ms(conf.log_time_ms()), + Timestamp::Millis(conf.log_time_ms()), config_map[conf.type]}); }; RtcEventProcessor process; diff --git a/logging/rtc_event_log/rtc_event_log_unittest.cc b/logging/rtc_event_log/rtc_event_log_unittest.cc index c05940202b..579c652880 100644 --- a/logging/rtc_event_log/rtc_event_log_unittest.cc +++ b/logging/rtc_event_log/rtc_event_log_unittest.cc @@ -113,7 +113,7 @@ class RtcEventLogSession encoding_type_(std::get<2>(GetParam())), gen_(seed_ * 880001UL), verifier_(encoding_type_) { - clock_.SetTime(Timestamp::us(prng_.Rand())); + clock_.SetTime(Timestamp::Micros(prng_.Rand())); // Find the name of the current test, in order to use it as a temporary // filename. // TODO(terelius): Use a general utility function to generate a temp file. @@ -217,7 +217,7 @@ void RtcEventLogSession::WriteAudioRecvConfigs(size_t audio_recv_streams, RTC_CHECK(event_log != nullptr); uint32_t ssrc; for (size_t i = 0; i < audio_recv_streams; i++) { - clock_.AdvanceTime(TimeDelta::ms(prng_.Rand(20))); + clock_.AdvanceTime(TimeDelta::Millis(prng_.Rand(20))); do { ssrc = prng_.Rand(); } while (SsrcUsed(ssrc, incoming_extensions_)); @@ -234,7 +234,7 @@ void RtcEventLogSession::WriteAudioSendConfigs(size_t audio_send_streams, RTC_CHECK(event_log != nullptr); uint32_t ssrc; for (size_t i = 0; i < audio_send_streams; i++) { - clock_.AdvanceTime(TimeDelta::ms(prng_.Rand(20))); + clock_.AdvanceTime(TimeDelta::Millis(prng_.Rand(20))); do { ssrc = prng_.Rand(); } while (SsrcUsed(ssrc, outgoing_extensions_)); @@ -256,14 +256,14 @@ void RtcEventLogSession::WriteVideoRecvConfigs(size_t video_recv_streams, RtpHeaderExtensionMap all_extensions = ParsedRtcEventLog::GetDefaultHeaderExtensionMap(); - clock_.AdvanceTime(TimeDelta::ms(prng_.Rand(20))); + clock_.AdvanceTime(TimeDelta::Millis(prng_.Rand(20))); uint32_t ssrc = prng_.Rand(); incoming_extensions_.emplace_back(ssrc, all_extensions); auto event = gen_.NewVideoReceiveStreamConfig(ssrc, all_extensions); event_log->Log(event->Copy()); video_recv_config_list_.push_back(std::move(event)); for (size_t i = 1; i < video_recv_streams; i++) { - clock_.AdvanceTime(TimeDelta::ms(prng_.Rand(20))); + clock_.AdvanceTime(TimeDelta::Millis(prng_.Rand(20))); do { ssrc = prng_.Rand(); } while (SsrcUsed(ssrc, incoming_extensions_)); @@ -285,14 +285,14 @@ void RtcEventLogSession::WriteVideoSendConfigs(size_t video_send_streams, RtpHeaderExtensionMap all_extensions = ParsedRtcEventLog::GetDefaultHeaderExtensionMap(); - clock_.AdvanceTime(TimeDelta::ms(prng_.Rand(20))); + clock_.AdvanceTime(TimeDelta::Millis(prng_.Rand(20))); uint32_t ssrc = prng_.Rand(); outgoing_extensions_.emplace_back(ssrc, all_extensions); auto event = gen_.NewVideoSendStreamConfig(ssrc, all_extensions); event_log->Log(event->Copy()); video_send_config_list_.push_back(std::move(event)); for (size_t i = 1; i < video_send_streams; i++) { - clock_.AdvanceTime(TimeDelta::ms(prng_.Rand(20))); + clock_.AdvanceTime(TimeDelta::Millis(prng_.Rand(20))); do { ssrc = prng_.Rand(); } while (SsrcUsed(ssrc, outgoing_extensions_)); @@ -329,7 +329,7 @@ void RtcEventLogSession::WriteLog(EventCounts count, size_t remaining_events_at_start = remaining_events - num_events_before_start; for (; remaining_events > 0; remaining_events--) { if (remaining_events == remaining_events_at_start) { - clock_.AdvanceTime(TimeDelta::ms(prng_.Rand(20))); + clock_.AdvanceTime(TimeDelta::Millis(prng_.Rand(20))); event_log->StartLogging( std::make_unique(temp_filename_, 10000000), output_period_ms_); @@ -337,7 +337,7 @@ void RtcEventLogSession::WriteLog(EventCounts count, utc_start_time_us_ = rtc::TimeUTCMicros(); } - clock_.AdvanceTime(TimeDelta::ms(prng_.Rand(20))); + clock_.AdvanceTime(TimeDelta::Millis(prng_.Rand(20))); size_t selection = prng_.Rand(remaining_events - 1); first_timestamp_ms_ = std::min(first_timestamp_ms_, rtc::TimeMillis()); last_timestamp_ms_ = std::max(last_timestamp_ms_, rtc::TimeMillis()); @@ -844,7 +844,7 @@ TEST_P(RtcEventLogCircularBufferTest, KeepsMostRecentEvents) { std::unique_ptr fake_clock = std::make_unique(); - fake_clock->SetTime(Timestamp::seconds(kStartTimeSeconds)); + fake_clock->SetTime(Timestamp::Seconds(kStartTimeSeconds)); auto task_queue_factory = CreateDefaultTaskQueueFactory(); RtcEventLogFactory rtc_event_log_factory(task_queue_factory.get()); @@ -862,14 +862,14 @@ TEST_P(RtcEventLogCircularBufferTest, KeepsMostRecentEvents) { // consistency checks when we read back. log_dumper->Log(std::make_unique( i, kStartBitrate + i * 1000)); - fake_clock->AdvanceTime(TimeDelta::ms(10)); + fake_clock->AdvanceTime(TimeDelta::Millis(10)); } int64_t start_time_us = rtc::TimeMicros(); int64_t utc_start_time_us = rtc::TimeUTCMicros(); log_dumper->StartLogging( std::make_unique(temp_filename, 10000000), RtcEventLog::kImmediateOutput); - fake_clock->AdvanceTime(TimeDelta::ms(10)); + fake_clock->AdvanceTime(TimeDelta::Millis(10)); int64_t stop_time_us = rtc::TimeMicros(); log_dumper->StopLogging(); @@ -902,9 +902,9 @@ TEST_P(RtcEventLogCircularBufferTest, KeepsMostRecentEvents) { // destroyed before the new one is created, so we have to reset() first. fake_clock.reset(); fake_clock = std::make_unique(); - fake_clock->SetTime(Timestamp::us(first_timestamp_us)); + fake_clock->SetTime(Timestamp::Micros(first_timestamp_us)); for (size_t i = 1; i < probe_success_events.size(); i++) { - fake_clock->AdvanceTime(TimeDelta::ms(10)); + fake_clock->AdvanceTime(TimeDelta::Millis(10)); verifier_.VerifyLoggedBweProbeSuccessEvent( RtcEventProbeResultSuccess(first_id + i, first_bitrate_bps + i * 1000), probe_success_events[i]); diff --git a/media/base/rtp_data_engine_unittest.cc b/media/base/rtp_data_engine_unittest.cc index e46c83edd3..dab4058c33 100644 --- a/media/base/rtp_data_engine_unittest.cc +++ b/media/base/rtp_data_engine_unittest.cc @@ -60,7 +60,7 @@ class RtpDataMediaChannelTest : public ::testing::Test { receiver_.reset(new FakeDataReceiver()); } - void SetNow(double now) { clock_.SetTime(webrtc::Timestamp::seconds(now)); } + void SetNow(double now) { clock_.SetTime(webrtc::Timestamp::Seconds(now)); } cricket::RtpDataEngine* CreateEngine() { cricket::RtpDataEngine* dme = new cricket::RtpDataEngine(); diff --git a/media/engine/webrtc_video_engine_unittest.cc b/media/engine/webrtc_video_engine_unittest.cc index 975761123a..fbff8c92f9 100644 --- a/media/engine/webrtc_video_engine_unittest.cc +++ b/media/engine/webrtc_video_engine_unittest.cc @@ -251,7 +251,7 @@ class WebRtcVideoEngineTest : public ::testing::Test { decoder_factory_)) { // Ensure fake clock doesn't return 0, which will cause some initializations // fail inside RTP senders. - fake_clock_.AdvanceTime(webrtc::TimeDelta::us(1)); + fake_clock_.AdvanceTime(webrtc::TimeDelta::Micros(1)); } protected: @@ -3870,7 +3870,7 @@ TEST_F(WebRtcVideoChannelTest, EstimatesNtpStartTimeCorrectly) { // This timestamp is kInitialTimestamp (-1) + kFrameOffsetMs * 90, which // triggers a constant-overflow warning, hence we're calculating it explicitly // here. - fake_clock_.AdvanceTime(webrtc::TimeDelta::ms(kFrameOffsetMs)); + fake_clock_.AdvanceTime(webrtc::TimeDelta::Millis(kFrameOffsetMs)); video_frame.set_timestamp(kFrameOffsetMs * 90 - 1); video_frame.set_ntp_time_ms(kInitialNtpTimeMs + kFrameOffsetMs); stream->InjectFrame(video_frame); diff --git a/p2p/base/dtls_transport_unittest.cc b/p2p/base/dtls_transport_unittest.cc index 287264da9e..8ac6e9b8a6 100644 --- a/p2p/base/dtls_transport_unittest.cc +++ b/p2p/base/dtls_transport_unittest.cc @@ -584,9 +584,10 @@ TEST_F(DtlsTransportTest, TestRetransmissionSchedule) { // millisecond before the expected time and verify that no unexpected // retransmissions were sent. Then advance it the final millisecond and // verify that the expected retransmission was sent. - fake_clock_.AdvanceTime(webrtc::TimeDelta::ms(timeout_schedule_ms[i] - 1)); + fake_clock_.AdvanceTime( + webrtc::TimeDelta::Millis(timeout_schedule_ms[i] - 1)); EXPECT_EQ(expected_hellos, client1_.received_dtls_client_hellos()); - fake_clock_.AdvanceTime(webrtc::TimeDelta::ms(1)); + fake_clock_.AdvanceTime(webrtc::TimeDelta::Millis(1)); EXPECT_EQ(++expected_hellos, client1_.received_dtls_client_hellos()); } } diff --git a/p2p/base/p2p_transport_channel_unittest.cc b/p2p/base/p2p_transport_channel_unittest.cc index 5f84aa3cf1..ff60767ceb 100644 --- a/p2p/base/p2p_transport_channel_unittest.cc +++ b/p2p/base/p2p_transport_channel_unittest.cc @@ -3619,7 +3619,7 @@ TEST_F(P2PTransportChannelPingTest, TestReceivingStateChange) { Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1, &clock); ASSERT_TRUE(conn1 != nullptr); - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); conn1->ReceivedPing(); conn1->OnReadPacket("ABC", 3, rtc::TimeMicros()); EXPECT_TRUE_SIMULATED_WAIT(ch.receiving(), kShortTimeout, clock); @@ -3854,7 +3854,7 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionBasedOnMediaReceived) { TEST_F(P2PTransportChannelPingTest, TestControlledAgentDataReceivingTakesHigherPrecedenceThanPriority) { rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("SwitchSelectedConnection", 1, &pa); PrepareChannel(&ch); @@ -3902,7 +3902,7 @@ TEST_F(P2PTransportChannelPingTest, TEST_F(P2PTransportChannelPingTest, TestControlledAgentNominationTakesHigherPrecedenceThanDataReceiving) { rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("SwitchSelectedConnection", 1, &pa); @@ -3942,7 +3942,7 @@ TEST_F(P2PTransportChannelPingTest, TEST_F(P2PTransportChannelPingTest, TestControlledAgentSelectsConnectionWithHigherNomination) { rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test", 1, &pa); @@ -3989,7 +3989,7 @@ TEST_F(P2PTransportChannelPingTest, TEST_F(P2PTransportChannelPingTest, TestControlledAgentIgnoresSmallerNomination) { rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test", 1, &pa); @@ -4089,7 +4089,7 @@ TEST_F(P2PTransportChannelPingTest, TestAddRemoteCandidateWithAddressReuse) { // will be pruned. Otherwise, lower-priority connections are kept. TEST_F(P2PTransportChannelPingTest, TestDontPruneWhenWeak) { rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test channel", 1, &pa); PrepareChannel(&ch); @@ -4149,7 +4149,7 @@ TEST_F(P2PTransportChannelPingTest, TestDontPruneHighPriorityConnections) { // Test that GetState returns the state correctly. TEST_F(P2PTransportChannelPingTest, TestGetState) { rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test channel", 1, &pa); EXPECT_EQ(webrtc::IceTransportState::kNew, ch.GetIceTransportState()); @@ -4189,7 +4189,7 @@ TEST_F(P2PTransportChannelPingTest, TestGetState) { // right away, and it can become active and be pruned again. TEST_F(P2PTransportChannelPingTest, TestConnectionPrunedAgain) { rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test channel", 1, &pa); @@ -4368,7 +4368,7 @@ TEST_F(P2PTransportChannelPingTest, TestPortDestroyedAfterTimeoutAndPruned) { // Simulate 2 minutes going by. This should be enough time for the port to // time out. for (int second = 0; second < 120; ++second) { - fake_clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + fake_clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); } EXPECT_EQ(nullptr, GetConnectionTo(&ch, "1.1.1.1", 1)); // Port will not be removed because it is not pruned yet. @@ -5445,7 +5445,7 @@ TEST_F(P2PTransportChannelPingTest, TestInitialSelectDampening0) { constexpr int kMargin = 10; rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test channel", 1, &pa); @@ -5469,7 +5469,7 @@ TEST_F(P2PTransportChannelPingTest, TestInitialSelectDampening) { constexpr int kMargin = 10; rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test channel", 1, &pa); @@ -5493,7 +5493,7 @@ TEST_F(P2PTransportChannelPingTest, TestInitialSelectDampeningPingReceived) { constexpr int kMargin = 10; rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test channel", 1, &pa); @@ -5520,7 +5520,7 @@ TEST_F(P2PTransportChannelPingTest, TestInitialSelectDampeningBoth) { constexpr int kMargin = 10; rtc::ScopedFakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::seconds(1)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(1)); FakePortAllocator pa(rtc::Thread::Current(), nullptr); P2PTransportChannel ch("test channel", 1, &pa); diff --git a/p2p/base/port_unittest.cc b/p2p/base/port_unittest.cc index e2dde8358c..c701da229b 100644 --- a/p2p/base/port_unittest.cc +++ b/p2p/base/port_unittest.cc @@ -255,7 +255,7 @@ static void SendPingAndReceiveResponse(Connection* lconn, ASSERT_TRUE(lport->last_stun_buf()); rconn->OnReadPacket(lport->last_stun_buf()->data(), lport->last_stun_buf()->size(), /* packet_time_us */ -1); - clock->AdvanceTime(webrtc::TimeDelta::ms(ms)); + clock->AdvanceTime(webrtc::TimeDelta::Millis(ms)); ASSERT_TRUE_WAIT(rport->last_stun_msg(), kDefaultTimeout); ASSERT_TRUE(rport->last_stun_buf()); lconn->OnReadPacket(rport->last_stun_buf()->data(), diff --git a/p2p/base/turn_port_unittest.cc b/p2p/base/turn_port_unittest.cc index e8c1a6e0f3..1f5a7bf49e 100644 --- a/p2p/base/turn_port_unittest.cc +++ b/p2p/base/turn_port_unittest.cc @@ -166,7 +166,7 @@ class TurnPortTest : public ::testing::Test, // Some code uses "last received time == 0" to represent "nothing received // so far", so we need to start the fake clock at a nonzero time... // TODO(deadbeef): Fix this. - fake_clock_.AdvanceTime(webrtc::TimeDelta::seconds(1)); + fake_clock_.AdvanceTime(webrtc::TimeDelta::Seconds(1)); } virtual void OnMessage(rtc::Message* msg) { diff --git a/pc/peer_connection_integrationtest.cc b/pc/peer_connection_integrationtest.cc index 4c7ea0c4e7..0a6e5d1faf 100644 --- a/pc/peer_connection_integrationtest.cc +++ b/pc/peer_connection_integrationtest.cc @@ -1723,7 +1723,7 @@ class FakeClockForTest : public rtc::ScopedFakeClock { // Some things use a time of "0" as a special value, so we need to start out // the fake clock at a nonzero time. // TODO(deadbeef): Fix this. - AdvanceTime(webrtc::TimeDelta::seconds(1)); + AdvanceTime(webrtc::TimeDelta::Seconds(1)); } // Explicit handle. diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc index 59d2e5d10a..f5b3d6d733 100644 --- a/pc/rtc_stats_collector_unittest.cc +++ b/pc/rtc_stats_collector_unittest.cc @@ -748,7 +748,7 @@ TEST_F(RTCStatsCollectorTest, CachedStatsReports) { rtc::scoped_refptr c = stats_->GetStatsReport(); EXPECT_NE(b.get(), c.get()); // Invalidate cache by advancing time. - fake_clock_.AdvanceTime(TimeDelta::ms(51)); + fake_clock_.AdvanceTime(TimeDelta::Millis(51)); rtc::scoped_refptr d = stats_->GetStatsReport(); EXPECT_TRUE(d); EXPECT_NE(c.get(), d.get()); @@ -759,7 +759,7 @@ TEST_F(RTCStatsCollectorTest, MultipleCallbacksWithInvalidatedCacheInBetween) { stats_->stats_collector()->GetStatsReport(RTCStatsObtainer::Create(&a)); stats_->stats_collector()->GetStatsReport(RTCStatsObtainer::Create(&b)); // Cache is invalidated after 50 ms. - fake_clock_.AdvanceTime(TimeDelta::ms(51)); + fake_clock_.AdvanceTime(TimeDelta::Millis(51)); stats_->stats_collector()->GetStatsReport(RTCStatsObtainer::Create(&c)); EXPECT_TRUE_WAIT(a, kGetStatsReportTimeoutMs); EXPECT_TRUE_WAIT(b, kGetStatsReportTimeoutMs); @@ -2582,7 +2582,7 @@ TEST_P(RTCStatsCollectorTestWithParamKind, // The report block's timestamp cannot be from the future, set the fake clock // to match. - fake_clock_.SetTime(Timestamp::us(kReportBlockTimestampUtcUs)); + fake_clock_.SetTime(Timestamp::Micros(kReportBlockTimestampUtcUs)); RTCPReportBlock report_block; // The remote-inbound-rtp SSRC and the outbound-rtp SSRC is the same as the @@ -2631,7 +2631,7 @@ TEST_P(RTCStatsCollectorTestWithParamKind, TEST_P(RTCStatsCollectorTestWithParamKind, RTCRemoteInboundRtpStreamStatsWithTimestampFromReportBlock) { const int64_t kReportBlockTimestampUtcUs = 123456789; - fake_clock_.SetTime(Timestamp::us(kReportBlockTimestampUtcUs)); + fake_clock_.SetTime(Timestamp::Micros(kReportBlockTimestampUtcUs)); RTCPReportBlock report_block; // The remote-inbound-rtp SSRC and the outbound-rtp SSRC is the same as the @@ -2644,7 +2644,7 @@ TEST_P(RTCStatsCollectorTestWithParamKind, absl::nullopt); // Advance time, it should be OK to have fresher reports than report blocks. - fake_clock_.AdvanceTime(TimeDelta::us(1234)); + fake_clock_.AdvanceTime(TimeDelta::Micros(1234)); rtc::scoped_refptr report = stats_->GetStatsReport(); @@ -2663,7 +2663,7 @@ TEST_P(RTCStatsCollectorTestWithParamKind, TEST_P(RTCStatsCollectorTestWithParamKind, RTCRemoteInboundRtpStreamStatsWithCodecBasedMembers) { const int64_t kReportBlockTimestampUtcUs = 123456789; - fake_clock_.SetTime(Timestamp::us(kReportBlockTimestampUtcUs)); + fake_clock_.SetTime(Timestamp::Micros(kReportBlockTimestampUtcUs)); RTCPReportBlock report_block; // The remote-inbound-rtp SSRC and the outbound-rtp SSRC is the same as the @@ -2700,7 +2700,7 @@ TEST_P(RTCStatsCollectorTestWithParamKind, TEST_P(RTCStatsCollectorTestWithParamKind, RTCRemoteInboundRtpStreamStatsWithRtcpTransport) { const int64_t kReportBlockTimestampUtcUs = 123456789; - fake_clock_.SetTime(Timestamp::us(kReportBlockTimestampUtcUs)); + fake_clock_.SetTime(Timestamp::Micros(kReportBlockTimestampUtcUs)); RTCPReportBlock report_block; // The remote-inbound-rtp SSRC and the outbound-rtp SSRC is the same as the diff --git a/pc/test/fake_periodic_video_source.h b/pc/test/fake_periodic_video_source.h index 80dff70914..1684ca4adb 100644 --- a/pc/test/fake_periodic_video_source.h +++ b/pc/test/fake_periodic_video_source.h @@ -48,7 +48,7 @@ class FakePeriodicVideoSource final thread_checker_.Detach(); frame_source_.SetRotation(config.rotation); - TimeDelta frame_interval = TimeDelta::ms(config.frame_interval_ms); + TimeDelta frame_interval = TimeDelta::Millis(config.frame_interval_ms); RepeatingTaskHandle::Start(task_queue_->Get(), [this, frame_interval] { if (broadcaster_.wants().rotation_applied) { broadcaster_.OnFrame(frame_source_.GetFrameRotationApplied()); diff --git a/pc/video_rtp_track_source_unittest.cc b/pc/video_rtp_track_source_unittest.cc index dd527bf59b..ed26db3654 100644 --- a/pc/video_rtp_track_source_unittest.cc +++ b/pc/video_rtp_track_source_unittest.cc @@ -118,7 +118,7 @@ class TestFrame : public RecordableEncodedFrame { EncodedResolution resolution() const override { return EncodedResolution{0, 0}; } - Timestamp render_time() const override { return Timestamp::ms(0); } + Timestamp render_time() const override { return Timestamp::Millis(0); } }; TEST(VideoRtpTrackSourceTest, BroadcastsFrames) { diff --git a/rtc_base/experiments/field_trial_units.cc b/rtc_base/experiments/field_trial_units.cc index 9c9cf434d9..81112255e6 100644 --- a/rtc_base/experiments/field_trial_units.cc +++ b/rtc_base/experiments/field_trial_units.cc @@ -74,11 +74,11 @@ absl::optional ParseTypedParameter(std::string str) { absl::optional result = ParseValueWithUnit(str); if (result) { if (result->unit == "s" || result->unit == "seconds") { - return TimeDelta::seconds(result->value); + return TimeDelta::Seconds(result->value); } else if (result->unit == "us") { - return TimeDelta::us(result->value); + return TimeDelta::Micros(result->value); } else if (result->unit.empty() || result->unit == "ms") { - return TimeDelta::ms(result->value); + return TimeDelta::Millis(result->value); } } return absl::nullopt; diff --git a/rtc_base/experiments/field_trial_units_unittest.cc b/rtc_base/experiments/field_trial_units_unittest.cc index 189fd103e9..adb62ba9a0 100644 --- a/rtc_base/experiments/field_trial_units_unittest.cc +++ b/rtc_base/experiments/field_trial_units_unittest.cc @@ -21,7 +21,7 @@ struct DummyExperiment { FieldTrialParameter target_rate = FieldTrialParameter("t", DataRate::kbps(100)); FieldTrialParameter period = - FieldTrialParameter("p", TimeDelta::ms(100)); + FieldTrialParameter("p", TimeDelta::Millis(100)); FieldTrialOptional max_buffer = FieldTrialOptional("b", absl::nullopt); @@ -35,19 +35,19 @@ TEST(FieldTrialParserUnitsTest, FallsBackToDefaults) { DummyExperiment exp(""); EXPECT_EQ(exp.target_rate.Get(), DataRate::kbps(100)); EXPECT_FALSE(exp.max_buffer.GetOptional().has_value()); - EXPECT_EQ(exp.period.Get(), TimeDelta::ms(100)); + EXPECT_EQ(exp.period.Get(), TimeDelta::Millis(100)); } TEST(FieldTrialParserUnitsTest, ParsesUnitParameters) { DummyExperiment exp("t:300kbps,b:5bytes,p:300ms"); EXPECT_EQ(exp.target_rate.Get(), DataRate::kbps(300)); EXPECT_EQ(*exp.max_buffer.GetOptional(), DataSize::bytes(5)); - EXPECT_EQ(exp.period.Get(), TimeDelta::ms(300)); + EXPECT_EQ(exp.period.Get(), TimeDelta::Millis(300)); } TEST(FieldTrialParserUnitsTest, ParsesDefaultUnitParameters) { DummyExperiment exp("t:300,b:5,p:300"); EXPECT_EQ(exp.target_rate.Get(), DataRate::kbps(300)); EXPECT_EQ(*exp.max_buffer.GetOptional(), DataSize::bytes(5)); - EXPECT_EQ(exp.period.Get(), TimeDelta::ms(300)); + EXPECT_EQ(exp.period.Get(), TimeDelta::Millis(300)); } TEST(FieldTrialParserUnitsTest, ParsesInfinityParameter) { DummyExperiment exp("t:inf,p:inf"); @@ -58,13 +58,14 @@ TEST(FieldTrialParserUnitsTest, ParsesOtherUnitParameters) { DummyExperiment exp("t:300bps,p:0.3 seconds,b:8 bytes"); EXPECT_EQ(exp.target_rate.Get(), DataRate::bps(300)); EXPECT_EQ(*exp.max_buffer.GetOptional(), DataSize::bytes(8)); - EXPECT_EQ(exp.period.Get(), TimeDelta::ms(300)); + EXPECT_EQ(exp.period.Get(), TimeDelta::Millis(300)); } TEST(FieldTrialParserUnitsTest, IgnoresOutOfRange) { FieldTrialConstrained rate("r", DataRate::kbps(30), DataRate::kbps(10), DataRate::kbps(100)); - FieldTrialConstrained delta("d", TimeDelta::ms(30), - TimeDelta::ms(10), TimeDelta::ms(100)); + FieldTrialConstrained delta("d", TimeDelta::Millis(30), + TimeDelta::Millis(10), + TimeDelta::Millis(100)); FieldTrialConstrained size( "s", DataSize::bytes(30), DataSize::bytes(10), DataSize::bytes(100)); ParseFieldTrial({&rate, &delta, &size}, "r:0,d:0,s:0"); diff --git a/rtc_base/experiments/struct_parameters_parser_unittest.cc b/rtc_base/experiments/struct_parameters_parser_unittest.cc index 71b117f9dd..2f92b9fc6a 100644 --- a/rtc_base/experiments/struct_parameters_parser_unittest.cc +++ b/rtc_base/experiments/struct_parameters_parser_unittest.cc @@ -19,7 +19,7 @@ struct DummyConfig { unsigned size = 3; bool ping = 0; absl::optional duration; - absl::optional latency = TimeDelta::ms(100); + absl::optional latency = TimeDelta::Millis(100); std::unique_ptr Parser(); }; diff --git a/rtc_base/fake_clock_unittest.cc b/rtc_base/fake_clock_unittest.cc index 0cabce8f5f..fc1d5100e6 100644 --- a/rtc_base/fake_clock_unittest.cc +++ b/rtc_base/fake_clock_unittest.cc @@ -21,13 +21,13 @@ TEST(ScopedFakeClockTest, OverridesGlobalClock) { ScopedFakeClock scoped; EXPECT_EQ(rtc::TimeMicros(), 0); - scoped.AdvanceTime(webrtc::TimeDelta::ms(1)); + scoped.AdvanceTime(webrtc::TimeDelta::Millis(1)); EXPECT_EQ(rtc::TimeMicros(), 1000); - scoped.SetTime(webrtc::Timestamp::us(kFixedTimeUs)); + scoped.SetTime(webrtc::Timestamp::Micros(kFixedTimeUs)); EXPECT_EQ(rtc::TimeMicros(), kFixedTimeUs); - scoped.AdvanceTime(webrtc::TimeDelta::ms(1)); + scoped.AdvanceTime(webrtc::TimeDelta::Millis(1)); EXPECT_EQ(rtc::TimeMicros(), kFixedTimeUs + 1000); } diff --git a/rtc_base/gunit.h b/rtc_base/gunit.h index d49912524c..dedf3ee067 100644 --- a/rtc_base/gunit.h +++ b/rtc_base/gunit.h @@ -100,7 +100,7 @@ #define SIMULATED_WAIT(ex, timeout, clock) \ for (int64_t start = rtc::TimeMillis(); \ !(ex) && rtc::TimeMillis() < start + (timeout);) { \ - (clock).AdvanceTime(webrtc::TimeDelta::ms(1)); \ + (clock).AdvanceTime(webrtc::TimeDelta::Millis(1)); \ } // This returns the result of the test in res, so that we don't re-evaluate @@ -111,7 +111,7 @@ int64_t start = rtc::TimeMillis(); \ res = (ex); \ while (!res && rtc::TimeMillis() < start + (timeout)) { \ - (clock).AdvanceTime(webrtc::TimeDelta::ms(1)); \ + (clock).AdvanceTime(webrtc::TimeDelta::Millis(1)); \ res = (ex); \ } \ } while (0) diff --git a/rtc_base/numerics/sample_stats.cc b/rtc_base/numerics/sample_stats.cc index 7a6f01e3d4..4b33d97fdb 100644 --- a/rtc_base/numerics/sample_stats.cc +++ b/rtc_base/numerics/sample_stats.cc @@ -59,7 +59,7 @@ void SampleStats::AddSample(TimeDelta delta) { } void SampleStats::AddSampleMs(double delta_ms) { - AddSample(TimeDelta::ms(delta_ms)); + AddSample(TimeDelta::Millis(delta_ms)); } void SampleStats::AddSamples(const SampleStats& other) { stats_.AddSamples(other.stats_); @@ -70,11 +70,11 @@ bool SampleStats::IsEmpty() { } TimeDelta SampleStats::Max() { - return TimeDelta::seconds(stats_.Max()); + return TimeDelta::Seconds(stats_.Max()); } TimeDelta SampleStats::Mean() { - return TimeDelta::seconds(stats_.Mean()); + return TimeDelta::Seconds(stats_.Mean()); } TimeDelta SampleStats::Median() { @@ -82,19 +82,19 @@ TimeDelta SampleStats::Median() { } TimeDelta SampleStats::Quantile(double quantile) { - return TimeDelta::seconds(stats_.Quantile(quantile)); + return TimeDelta::Seconds(stats_.Quantile(quantile)); } TimeDelta SampleStats::Min() { - return TimeDelta::seconds(stats_.Min()); + return TimeDelta::Seconds(stats_.Min()); } TimeDelta SampleStats::Variance() { - return TimeDelta::seconds(stats_.Variance()); + return TimeDelta::Seconds(stats_.Variance()); } TimeDelta SampleStats::StandardDeviation() { - return TimeDelta::seconds(stats_.StandardDeviation()); + return TimeDelta::Seconds(stats_.StandardDeviation()); } int SampleStats::Count() { diff --git a/rtc_base/numerics/samples_stats_counter.cc b/rtc_base/numerics/samples_stats_counter.cc index c262d48be9..9b98a3181d 100644 --- a/rtc_base/numerics/samples_stats_counter.cc +++ b/rtc_base/numerics/samples_stats_counter.cc @@ -27,7 +27,7 @@ SamplesStatsCounter& SamplesStatsCounter::operator=(SamplesStatsCounter&&) = default; void SamplesStatsCounter::AddSample(double value) { - AddSample(StatsSample{value, Timestamp::us(rtc::TimeMicros())}); + AddSample(StatsSample{value, Timestamp::Micros(rtc::TimeMicros())}); } void SamplesStatsCounter::AddSample(StatsSample sample) { diff --git a/rtc_base/task_utils/repeating_task.cc b/rtc_base/task_utils/repeating_task.cc index aeeb7c071a..4e460bb082 100644 --- a/rtc_base/task_utils/repeating_task.cc +++ b/rtc_base/task_utils/repeating_task.cc @@ -20,7 +20,7 @@ namespace webrtc_repeating_task_impl { RepeatingTaskBase::RepeatingTaskBase(TaskQueueBase* task_queue, TimeDelta first_delay) : task_queue_(task_queue), - next_run_time_(Timestamp::us(rtc::TimeMicros()) + first_delay) {} + next_run_time_(Timestamp::Micros(rtc::TimeMicros()) + first_delay) {} RepeatingTaskBase::~RepeatingTaskBase() = default; @@ -38,7 +38,7 @@ bool RepeatingTaskBase::Run() { return true; RTC_DCHECK(delay.IsFinite()); - TimeDelta lost_time = Timestamp::us(rtc::TimeMicros()) - next_run_time_; + TimeDelta lost_time = Timestamp::Micros(rtc::TimeMicros()) - next_run_time_; next_run_time_ += delay; delay -= lost_time; delay = std::max(delay, TimeDelta::Zero()); diff --git a/rtc_base/task_utils/repeating_task_unittest.cc b/rtc_base/task_utils/repeating_task_unittest.cc index 469ee316f3..83efb29209 100644 --- a/rtc_base/task_utils/repeating_task_unittest.cc +++ b/rtc_base/task_utils/repeating_task_unittest.cc @@ -30,7 +30,7 @@ using ::testing::MockFunction; using ::testing::NiceMock; using ::testing::Return; -constexpr TimeDelta kTimeout = TimeDelta::Millis<1000>(); +constexpr TimeDelta kTimeout = TimeDelta::Millis(1000); void Sleep(TimeDelta time_delta) { // Note that Chromium style guide prohibits use of and in @@ -63,8 +63,8 @@ class MoveOnlyClosure { } // namespace TEST(RepeatingTaskTest, TaskIsStoppedOnStop) { - const TimeDelta kShortInterval = TimeDelta::ms(50); - const TimeDelta kLongInterval = TimeDelta::ms(200); + const TimeDelta kShortInterval = TimeDelta::Millis(50); + const TimeDelta kLongInterval = TimeDelta::Millis(200); const int kShortIntervalCount = 4; const int kMargin = 1; @@ -90,10 +90,10 @@ TEST(RepeatingTaskTest, TaskIsStoppedOnStop) { TEST(RepeatingTaskTest, CompensatesForLongRunTime) { const int kTargetCount = 20; const int kTargetCountMargin = 2; - const TimeDelta kRepeatInterval = TimeDelta::ms(2); + const TimeDelta kRepeatInterval = TimeDelta::Millis(2); // Sleeping inside the task for longer than the repeat interval once, should // be compensated for by repeating the task faster to catch up. - const TimeDelta kSleepDuration = TimeDelta::ms(20); + const TimeDelta kSleepDuration = TimeDelta::Millis(20); const int kSleepAtCount = 3; std::atomic_int counter(0); @@ -115,10 +115,10 @@ TEST(RepeatingTaskTest, CompensatesForShortRunTime) { RepeatingTaskHandle::Start(task_queue.Get(), [&] { ++counter; // Sleeping for the 100 ms should be compensated. - Sleep(TimeDelta::ms(100)); - return TimeDelta::ms(300); + Sleep(TimeDelta::Millis(100)); + return TimeDelta::Millis(300); }); - Sleep(TimeDelta::ms(400)); + Sleep(TimeDelta::Millis(400)); // We expect that the task have been called twice, once directly at Start and // once after 300 ms has passed. @@ -132,7 +132,7 @@ TEST(RepeatingTaskTest, CancelDelayedTaskBeforeItRuns) { EXPECT_CALL(mock, Delete).WillOnce(Invoke([&done] { done.Set(); })); TaskQueueForTest task_queue("queue"); auto handle = RepeatingTaskHandle::DelayedStart( - task_queue.Get(), TimeDelta::ms(100), MoveOnlyClosure(&mock)); + task_queue.Get(), TimeDelta::Millis(100), MoveOnlyClosure(&mock)); task_queue.PostTask( [handle = std::move(handle)]() mutable { handle.Stop(); }); EXPECT_TRUE(done.Wait(kTimeout.ms())); @@ -141,7 +141,7 @@ TEST(RepeatingTaskTest, CancelDelayedTaskBeforeItRuns) { TEST(RepeatingTaskTest, CancelTaskAfterItRuns) { rtc::Event done; MockClosure mock; - EXPECT_CALL(mock, Call).WillOnce(Return(TimeDelta::ms(100))); + EXPECT_CALL(mock, Call).WillOnce(Return(TimeDelta::Millis(100))); EXPECT_CALL(mock, Delete).WillOnce(Invoke([&done] { done.Set(); })); TaskQueueForTest task_queue("queue"); auto handle = @@ -159,10 +159,10 @@ TEST(RepeatingTaskTest, TaskCanStopItself) { handle = RepeatingTaskHandle::Start(task_queue.Get(), [&] { ++counter; handle.Stop(); - return TimeDelta::ms(2); + return TimeDelta::Millis(2); }); }); - Sleep(TimeDelta::ms(10)); + Sleep(TimeDelta::Millis(10)); EXPECT_EQ(counter.load(), 1); } @@ -184,8 +184,8 @@ TEST(RepeatingTaskTest, StartPeriodicTask) { MockFunction closure; rtc::Event done; EXPECT_CALL(closure, Call()) - .WillOnce(Return(TimeDelta::ms(20))) - .WillOnce(Return(TimeDelta::ms(20))) + .WillOnce(Return(TimeDelta::Millis(20))) + .WillOnce(Return(TimeDelta::Millis(20))) .WillOnce(Invoke([&done] { done.Set(); return kTimeout; @@ -199,7 +199,7 @@ TEST(RepeatingTaskTest, Example) { class ObjectOnTaskQueue { public: void DoPeriodicTask() {} - TimeDelta TimeUntilNextRun() { return TimeDelta::ms(100); } + TimeDelta TimeUntilNextRun() { return TimeDelta::Millis(100); } void StartPeriodicTask(RepeatingTaskHandle* handle, TaskQueueBase* task_queue) { *handle = RepeatingTaskHandle::Start(task_queue, [this] { diff --git a/rtc_base/thread_unittest.cc b/rtc_base/thread_unittest.cc index 2cd21de0e8..fb54bb557d 100644 --- a/rtc_base/thread_unittest.cc +++ b/rtc_base/thread_unittest.cc @@ -1134,7 +1134,7 @@ TEST(ThreadPostDelayedTaskTest, InvokesInDelayOrder) { // All tasks have been posted before the first one is unblocked. first.Set(); // Only if the chain is invoked in delay order will the last event be set. - clock.AdvanceTime(webrtc::TimeDelta::ms(11)); + clock.AdvanceTime(webrtc::TimeDelta::Millis(11)); EXPECT_TRUE(fourth.Wait(0)); } diff --git a/rtc_base/time_utils_unittest.cc b/rtc_base/time_utils_unittest.cc index 824c2c056b..2663714b7a 100644 --- a/rtc_base/time_utils_unittest.cc +++ b/rtc_base/time_utils_unittest.cc @@ -218,7 +218,7 @@ TEST(FakeClock, TimeFunctionsUseFakeClock) { FakeClock clock; SetClockForTesting(&clock); - clock.SetTime(webrtc::Timestamp::us(987654)); + clock.SetTime(webrtc::Timestamp::Micros(987654)); EXPECT_EQ(987u, Time32()); EXPECT_EQ(987, TimeMillis()); EXPECT_EQ(987654, TimeMicros()); @@ -237,21 +237,21 @@ TEST(FakeClock, InitialTime) { TEST(FakeClock, SetTime) { FakeClock clock; - clock.SetTime(webrtc::Timestamp::us(123)); + clock.SetTime(webrtc::Timestamp::Micros(123)); EXPECT_EQ(123000, clock.TimeNanos()); - clock.SetTime(webrtc::Timestamp::us(456)); + clock.SetTime(webrtc::Timestamp::Micros(456)); EXPECT_EQ(456000, clock.TimeNanos()); } TEST(FakeClock, AdvanceTime) { FakeClock clock; - clock.AdvanceTime(webrtc::TimeDelta::us(1u)); + clock.AdvanceTime(webrtc::TimeDelta::Micros(1u)); EXPECT_EQ(1000, clock.TimeNanos()); - clock.AdvanceTime(webrtc::TimeDelta::us(2222u)); + clock.AdvanceTime(webrtc::TimeDelta::Micros(2222u)); EXPECT_EQ(2223000, clock.TimeNanos()); - clock.AdvanceTime(webrtc::TimeDelta::ms(3333u)); + clock.AdvanceTime(webrtc::TimeDelta::Millis(3333u)); EXPECT_EQ(3335223000, clock.TimeNanos()); - clock.AdvanceTime(webrtc::TimeDelta::seconds(4444u)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(4444u)); EXPECT_EQ(4447335223000, clock.TimeNanos()); } @@ -282,7 +282,7 @@ TEST(FakeClock, SettingTimeWakesThreads) { // Advance the fake clock, expecting the worker thread to wake up // and dispatch the message instantly. - clock.AdvanceTime(webrtc::TimeDelta::seconds(60u)); + clock.AdvanceTime(webrtc::TimeDelta::Seconds(60u)); EXPECT_TRUE(message_handler_dispatched.Wait(0)); worker->Stop(); diff --git a/rtc_base/virtual_socket_server.cc b/rtc_base/virtual_socket_server.cc index 318f34a2a2..d42873e18b 100644 --- a/rtc_base/virtual_socket_server.cc +++ b/rtc_base/virtual_socket_server.cc @@ -637,7 +637,7 @@ bool VirtualSocketServer::ProcessMessagesUntilIdle() { if (fake_clock_) { // If using a fake clock, advance it in millisecond increments until the // queue is empty. - fake_clock_->AdvanceTime(webrtc::TimeDelta::ms(1)); + fake_clock_->AdvanceTime(webrtc::TimeDelta::Millis(1)); } else { // Otherwise, run a normal message loop. Message msg; diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer.cc b/rtc_tools/rtc_event_log_visualizer/analyzer.cc index 59b96e423e..f972f474e3 100644 --- a/rtc_tools/rtc_event_log_visualizer/analyzer.cc +++ b/rtc_tools/rtc_event_log_visualizer/analyzer.cc @@ -1228,7 +1228,7 @@ void EventLogAnalyzer::CreateSendSideBweSimulationGraph(Plot* plot) { // TODO(holmer): Log the call config and use that here instead. static const uint32_t kDefaultStartBitrateBps = 300000; NetworkControllerConfig cc_config; - cc_config.constraints.at_time = Timestamp::us(clock.TimeInMicroseconds()); + cc_config.constraints.at_time = Timestamp::Micros(clock.TimeInMicroseconds()); cc_config.constraints.starting_rate = DataRate::bps(kDefaultStartBitrateBps); cc_config.event_log = &null_event_log; auto goog_cc = factory.Create(cc_config); @@ -1298,7 +1298,7 @@ void EventLogAnalyzer::CreateSendSideBweSimulationGraph(Plot* plot) { transport_feedback.AddPacket( packet_info, 0u, // Per packet overhead bytes. - Timestamp::us(rtp_packet.rtp.log_time_us())); + Timestamp::Micros(rtp_packet.rtp.log_time_us())); rtc::SentPacket sent_packet( rtp_packet.rtp.header.extension.transportSequenceNumber, rtp_packet.rtp.log_time_us() / 1000); @@ -1313,7 +1313,7 @@ void EventLogAnalyzer::CreateSendSideBweSimulationGraph(Plot* plot) { auto feedback_msg = transport_feedback.ProcessTransportFeedback( rtcp_iterator->transport_feedback, - Timestamp::ms(clock.TimeInMilliseconds())); + Timestamp::Millis(clock.TimeInMilliseconds())); absl::optional bitrate_bps; if (feedback_msg) { observer.Update(goog_cc->OnTransportPacketsFeedback(*feedback_msg)); @@ -1345,7 +1345,7 @@ void EventLogAnalyzer::CreateSendSideBweSimulationGraph(Plot* plot) { if (clock.TimeInMicroseconds() >= NextProcessTime()) { RTC_DCHECK_EQ(clock.TimeInMicroseconds(), NextProcessTime()); ProcessInterval msg; - msg.at_time = Timestamp::us(clock.TimeInMicroseconds()); + msg.at_time = Timestamp::Micros(clock.TimeInMicroseconds()); observer.Update(goog_cc->OnProcessInterval(msg)); next_process_time_us_ += process_interval.us(); } diff --git a/rtc_tools/rtc_event_log_visualizer/log_simulation.cc b/rtc_tools/rtc_event_log_visualizer/log_simulation.cc index e3399a8c9c..07752e7c1b 100644 --- a/rtc_tools/rtc_event_log_visualizer/log_simulation.cc +++ b/rtc_tools/rtc_event_log_visualizer/log_simulation.cc @@ -39,7 +39,7 @@ void LogBasedNetworkControllerSimulation::ProcessUntil(Timestamp to_time) { controller_ = factory_->Create(config); } if (last_process_.IsInfinite() || - to_time - last_process_ > TimeDelta::seconds(1)) { + to_time - last_process_ > TimeDelta::Seconds(1)) { last_process_ = to_time; current_time_ = to_time; ProcessInterval msg; @@ -107,7 +107,7 @@ void LogBasedNetworkControllerSimulation::OnPacketSent( void LogBasedNetworkControllerSimulation::OnFeedback( const LoggedRtcpPacketTransportFeedback& feedback) { - auto feedback_time = Timestamp::ms(feedback.log_time_ms()); + auto feedback_time = Timestamp::Millis(feedback.log_time_ms()); ProcessUntil(feedback_time); auto msg = transport_feedback_.ProcessTransportFeedback( feedback.transport_feedback, feedback_time); @@ -119,7 +119,7 @@ void LogBasedNetworkControllerSimulation::OnReceiverReport( const LoggedRtcpPacketReceiverReport& report) { if (report.rr.report_blocks().empty()) return; - auto report_time = Timestamp::ms(report.log_time_ms()); + auto report_time = Timestamp::Millis(report.log_time_ms()); ProcessUntil(report_time); int packets_delta = 0; int lost_delta = 0; @@ -150,7 +150,7 @@ void LogBasedNetworkControllerSimulation::OnReceiverReport( CompactNtp(TimeMicrosToNtp(report.log_time_us())); uint32_t rtt_ntp = receive_time_ntp - rb.delay_since_last_sr() - rb.last_sr(); - rtt = std::min(rtt, TimeDelta::ms(CompactNtpRttToMs(rtt_ntp))); + rtt = std::min(rtt, TimeDelta::Millis(CompactNtpRttToMs(rtt_ntp))); } } if (rtt.IsFinite()) { @@ -164,7 +164,7 @@ void LogBasedNetworkControllerSimulation::OnReceiverReport( void LogBasedNetworkControllerSimulation::OnIceConfig( const LoggedIceCandidatePairConfig& candidate) { if (candidate.type == IceCandidatePairConfigType::kSelected) { - auto log_time = Timestamp::us(candidate.log_time_us()); + auto log_time = Timestamp::Micros(candidate.log_time_us()); ProcessUntil(log_time); NetworkRouteChange msg; msg.at_time = log_time; diff --git a/system_wrappers/include/clock.h b/system_wrappers/include/clock.h index c026a4e7d9..94c87463d8 100644 --- a/system_wrappers/include/clock.h +++ b/system_wrappers/include/clock.h @@ -33,7 +33,7 @@ class Clock { virtual ~Clock() {} // Return a timestamp relative to an unspecified epoch. virtual Timestamp CurrentTime() { - return Timestamp::us(TimeInMicroseconds()); + return Timestamp::Micros(TimeInMicroseconds()); } virtual int64_t TimeInMilliseconds() { return CurrentTime().ms(); } virtual int64_t TimeInMicroseconds() { return CurrentTime().us(); } diff --git a/system_wrappers/source/clock.cc b/system_wrappers/source/clock.cc index 3eea155711..b0356fc40c 100644 --- a/system_wrappers/source/clock.cc +++ b/system_wrappers/source/clock.cc @@ -32,7 +32,9 @@ namespace webrtc { class RealTimeClock : public Clock { - Timestamp CurrentTime() override { return Timestamp::us(rtc::TimeMicros()); } + Timestamp CurrentTime() override { + return Timestamp::Micros(rtc::TimeMicros()); + } // Return a timestamp in milliseconds relative to some arbitrary source; the // source is fixed for this clock. int64_t TimeInMilliseconds() override { return rtc::TimeMillis(); } @@ -237,7 +239,7 @@ Clock* Clock::GetRealTimeClock() { } SimulatedClock::SimulatedClock(int64_t initial_time_us) - : SimulatedClock(Timestamp::us(initial_time_us)) {} + : SimulatedClock(Timestamp::Micros(initial_time_us)) {} SimulatedClock::SimulatedClock(Timestamp initial_time) : time_(initial_time), lock_(RWLockWrapper::CreateRWLock()) {} @@ -262,11 +264,11 @@ int64_t SimulatedClock::CurrentNtpInMilliseconds() { } void SimulatedClock::AdvanceTimeMilliseconds(int64_t milliseconds) { - AdvanceTime(TimeDelta::ms(milliseconds)); + AdvanceTime(TimeDelta::Millis(milliseconds)); } void SimulatedClock::AdvanceTimeMicroseconds(int64_t microseconds) { - AdvanceTime(TimeDelta::us(microseconds)); + AdvanceTime(TimeDelta::Micros(microseconds)); } void SimulatedClock::AdvanceTime(TimeDelta delta) { diff --git a/test/direct_transport.cc b/test/direct_transport.cc index 84273b0830..818480b18b 100644 --- a/test/direct_transport.cc +++ b/test/direct_transport.cc @@ -108,10 +108,10 @@ void DirectTransport::ProcessPackets() { return; next_process_task_ = RepeatingTaskHandle::DelayedStart( - task_queue_, TimeDelta::ms(*initial_delay_ms), [this] { + task_queue_, TimeDelta::Millis(*initial_delay_ms), [this] { fake_network_->Process(); if (auto delay_ms = fake_network_->TimeUntilNextProcess()) - return TimeDelta::ms(*delay_ms); + return TimeDelta::Millis(*delay_ms); // Otherwise stop the task. rtc::CritScope cs(&process_lock_); next_process_task_.Stop(); diff --git a/test/frame_generator_capturer.cc b/test/frame_generator_capturer.cc index 36249d672d..3a298cc528 100644 --- a/test/frame_generator_capturer.cc +++ b/test/frame_generator_capturer.cc @@ -167,9 +167,9 @@ bool FrameGeneratorCapturer::Init() { frame_task_ = RepeatingTaskHandle::DelayedStart( task_queue_.Get(), - TimeDelta::seconds(1) / GetCurrentConfiguredFramerate(), [this] { + TimeDelta::Seconds(1) / GetCurrentConfiguredFramerate(), [this] { InsertFrame(); - return TimeDelta::seconds(1) / GetCurrentConfiguredFramerate(); + return TimeDelta::Seconds(1) / GetCurrentConfiguredFramerate(); }); return true; } @@ -210,7 +210,7 @@ void FrameGeneratorCapturer::Start() { if (!frame_task_.Running()) { frame_task_ = RepeatingTaskHandle::Start(task_queue_.Get(), [this] { InsertFrame(); - return TimeDelta::seconds(1) / GetCurrentConfiguredFramerate(); + return TimeDelta::Seconds(1) / GetCurrentConfiguredFramerate(); }); } } diff --git a/test/frame_generator_capturer.h b/test/frame_generator_capturer.h index aaed205423..fcd5f9631f 100644 --- a/test/frame_generator_capturer.h +++ b/test/frame_generator_capturer.h @@ -48,7 +48,7 @@ struct FrameGeneratorCapturerConfig { struct SquareSlides { int framerate = 30; - TimeDelta change_interval = TimeDelta::seconds(10); + TimeDelta change_interval = TimeDelta::Seconds(10); int width = 1600; int height = 1200; }; @@ -63,9 +63,9 @@ struct FrameGeneratorCapturerConfig { struct ImageSlides { int framerate = 30; - TimeDelta change_interval = TimeDelta::seconds(10); + TimeDelta change_interval = TimeDelta::Seconds(10); struct Crop { - TimeDelta scroll_duration = TimeDelta::seconds(0); + TimeDelta scroll_duration = TimeDelta::Seconds(0); absl::optional width; absl::optional height; } crop; diff --git a/test/frame_generator_capturer_unittest.cc b/test/frame_generator_capturer_unittest.cc index 1434474c3f..7400bbb79b 100644 --- a/test/frame_generator_capturer_unittest.cc +++ b/test/frame_generator_capturer_unittest.cc @@ -27,7 +27,7 @@ class MockVideoSinkInterfaceVideoFrame }; } // namespace TEST(FrameGeneratorCapturerTest, CreateFromConfig) { - GlobalSimulatedTimeController time(Timestamp::seconds(1000)); + GlobalSimulatedTimeController time(Timestamp::Seconds(1000)); FrameGeneratorCapturerConfig config; config.squares_video->width = 300; config.squares_video->height = 200; @@ -39,7 +39,7 @@ TEST(FrameGeneratorCapturerTest, CreateFromConfig) { capturer->Start(); EXPECT_CALL(mock_sink, OnFrame(Property(&VideoFrame::width, Eq(300)))) .Times(21); - time.AdvanceTime(TimeDelta::seconds(1)); + time.AdvanceTime(TimeDelta::Seconds(1)); } } // namespace test } // namespace webrtc diff --git a/test/fuzzers/frame_buffer2_fuzzer.cc b/test/fuzzers/frame_buffer2_fuzzer.cc index 3ee40fda3a..7ec7da5eca 100644 --- a/test/fuzzers/frame_buffer2_fuzzer.cc +++ b/test/fuzzers/frame_buffer2_fuzzer.cc @@ -64,7 +64,7 @@ void FuzzOneInput(const uint8_t* data, size_t size) { return; } DataReader reader(data, size); - GlobalSimulatedTimeController time_controller(Timestamp::seconds(0)); + GlobalSimulatedTimeController time_controller(Timestamp::Seconds(0)); rtc::TaskQueue task_queue( time_controller.GetTaskQueueFactory()->CreateTaskQueue( "time_tq", TaskQueueFactory::Priority::NORMAL)); @@ -106,7 +106,7 @@ void FuzzOneInput(const uint8_t* data, size_t size) { } } - time_controller.AdvanceTime(TimeDelta::ms(reader.GetNum())); + time_controller.AdvanceTime(TimeDelta::Millis(reader.GetNum())); } } diff --git a/test/fuzzers/utils/rtp_replayer.cc b/test/fuzzers/utils/rtp_replayer.cc index af03be2f2c..4a4179991e 100644 --- a/test/fuzzers/utils/rtp_replayer.cc +++ b/test/fuzzers/utils/rtp_replayer.cc @@ -47,7 +47,7 @@ void RtpReplayer::Replay( // Work around: webrtc calls webrtc::Random(clock.TimeInMicroseconds()) // everywhere and Random expects non-zero seed. Let's set the clock non-zero // to make them happy. - fake_clock.SetTime(webrtc::Timestamp::ms(1)); + fake_clock.SetTime(webrtc::Timestamp::Millis(1)); // Attempt to create an RtpReader from the input file. auto rtp_reader = CreateRtpReader(rtp_dump_data, rtp_dump_size); @@ -155,7 +155,7 @@ void RtpReplayer::ReplayPackets(rtc::FakeClock* clock, if (deliver_in_ms > 0) { // StatsCounter::ReportMetricToAggregatedCounter is O(elapsed time). // Set an upper limit to prevent waste time. - clock->AdvanceTime(webrtc::TimeDelta::ms( + clock->AdvanceTime(webrtc::TimeDelta::Millis( std::min(deliver_in_ms, static_cast(100)))); } diff --git a/test/network/cross_traffic.cc b/test/network/cross_traffic.cc index 972e89f6fc..3fce124f75 100644 --- a/test/network/cross_traffic.cc +++ b/test/network/cross_traffic.cc @@ -207,7 +207,7 @@ void TcpMessageRouteImpl::HandleLoss(Timestamp at_time) { } void TcpMessageRouteImpl::SendPackets(Timestamp at_time) { - const TimeDelta kPacketTimeout = TimeDelta::seconds(1); + const TimeDelta kPacketTimeout = TimeDelta::Seconds(1); int cwnd = std::ceil(cwnd_); int packets_to_send = std::max(cwnd - static_cast(in_flight_.size()), 0); while (packets_to_send-- > 0 && !pending_.empty()) { diff --git a/test/network/cross_traffic.h b/test/network/cross_traffic.h index 663881fc64..b38ccfa645 100644 --- a/test/network/cross_traffic.h +++ b/test/network/cross_traffic.h @@ -31,8 +31,8 @@ struct RandomWalkConfig { int random_seed = 1; DataRate peak_rate = DataRate::kbps(100); DataSize min_packet_size = DataSize::bytes(200); - TimeDelta min_packet_interval = TimeDelta::ms(1); - TimeDelta update_interval = TimeDelta::ms(200); + TimeDelta min_packet_interval = TimeDelta::Millis(1); + TimeDelta update_interval = TimeDelta::Millis(200); double variance = 0.6; double bias = -0.1; }; @@ -65,9 +65,9 @@ class RandomWalkCrossTraffic { struct PulsedPeaksConfig { DataRate peak_rate = DataRate::kbps(100); DataSize min_packet_size = DataSize::bytes(200); - TimeDelta min_packet_interval = TimeDelta::ms(1); - TimeDelta send_duration = TimeDelta::ms(100); - TimeDelta hold_duration = TimeDelta::ms(2000); + TimeDelta min_packet_interval = TimeDelta::Millis(1); + TimeDelta send_duration = TimeDelta::Millis(100); + TimeDelta hold_duration = TimeDelta::Millis(2000); }; class PulsedPeaksCrossTraffic { @@ -152,8 +152,8 @@ class TcpMessageRouteImpl final : public TcpMessageRoute { struct FakeTcpConfig { DataSize packet_size = DataSize::bytes(1200); DataSize send_limit = DataSize::PlusInfinity(); - TimeDelta process_interval = TimeDelta::ms(200); - TimeDelta packet_timeout = TimeDelta::seconds(1); + TimeDelta process_interval = TimeDelta::Millis(200); + TimeDelta packet_timeout = TimeDelta::Seconds(1); }; class FakeTcpCrossTraffic diff --git a/test/network/cross_traffic_unittest.cc b/test/network/cross_traffic_unittest.cc index 43967e693c..768e59d640 100644 --- a/test/network/cross_traffic_unittest.cc +++ b/test/network/cross_traffic_unittest.cc @@ -72,13 +72,13 @@ TEST(CrossTrafficTest, PulsedPeaksCrossTraffic) { PulsedPeaksConfig config; config.peak_rate = DataRate::kbps(1000); config.min_packet_size = DataSize::bytes(1); - config.min_packet_interval = TimeDelta::ms(25); - config.send_duration = TimeDelta::ms(500); - config.hold_duration = TimeDelta::ms(250); + config.min_packet_interval = TimeDelta::Millis(25); + config.send_duration = TimeDelta::Millis(500); + config.hold_duration = TimeDelta::Millis(250); PulsedPeaksCrossTraffic pulsed_peaks(config, &traffic); - const auto kRunTime = TimeDelta::seconds(1); + const auto kRunTime = TimeDelta::Seconds(1); while (fixture.clock.TimeInMilliseconds() < kRunTime.ms()) { - pulsed_peaks.Process(Timestamp::ms(fixture.clock.TimeInMilliseconds())); + pulsed_peaks.Process(Timestamp::Millis(fixture.clock.TimeInMilliseconds())); fixture.clock.AdvanceTimeMilliseconds(1); } @@ -97,15 +97,15 @@ TEST(CrossTrafficTest, RandomWalkCrossTraffic) { RandomWalkConfig config; config.peak_rate = DataRate::kbps(1000); config.min_packet_size = DataSize::bytes(1); - config.min_packet_interval = TimeDelta::ms(25); - config.update_interval = TimeDelta::ms(500); + config.min_packet_interval = TimeDelta::Millis(25); + config.update_interval = TimeDelta::Millis(500); config.variance = 0.0; config.bias = 1.0; RandomWalkCrossTraffic random_walk(config, &traffic); - const auto kRunTime = TimeDelta::seconds(1); + const auto kRunTime = TimeDelta::Seconds(1); while (fixture.clock.TimeInMilliseconds() < kRunTime.ms()) { - random_walk.Process(Timestamp::ms(fixture.clock.TimeInMilliseconds())); + random_walk.Process(Timestamp::Millis(fixture.clock.TimeInMilliseconds())); fixture.clock.AdvanceTimeMilliseconds(1); } @@ -144,10 +144,10 @@ TEST(TcpMessageRouteTest, DeliveredOnLossyNetwork) { // If there was no loss, we would have delivered the message in ca 1 second, // with 50% it should take much longer. - net.time_controller()->AdvanceTime(TimeDelta::seconds(5)); + net.time_controller()->AdvanceTime(TimeDelta::Seconds(5)); ASSERT_EQ(deliver_count, 0); // But given enough time the messsage will be delivered, but only once. - net.time_controller()->AdvanceTime(TimeDelta::seconds(60)); + net.time_controller()->AdvanceTime(TimeDelta::Seconds(60)); EXPECT_EQ(deliver_count, 1); } diff --git a/test/network/feedback_generator_unittest.cc b/test/network/feedback_generator_unittest.cc index 54029d0d22..ca04bd3c9f 100644 --- a/test/network/feedback_generator_unittest.cc +++ b/test/network/feedback_generator_unittest.cc @@ -17,7 +17,7 @@ TEST(FeedbackGeneratorTest, ReportsFeedbackForSentPackets) { auto gen = CreateFeedbackGenerator(FeedbackGenerator::Config()); for (int i = 0; i < 10; ++i) { gen->SendPacket(kPacketSize); - gen->Sleep(TimeDelta::ms(50)); + gen->Sleep(TimeDelta::Millis(50)); } auto feedback_list = gen->PopFeedback(); EXPECT_GT(feedback_list.size(), 0u); diff --git a/test/network/network_emulation.cc b/test/network/network_emulation.cc index 57dcf51242..88315a9749 100644 --- a/test/network/network_emulation.cc +++ b/test/network/network_emulation.cc @@ -40,7 +40,7 @@ void LinkEmulation::OnPacketReceived(EmulatedIpPacket packet) { process_task_ = RepeatingTaskHandle::DelayedStart( task_queue_->Get(), std::max(TimeDelta::Zero(), - Timestamp::us(*next_time_us) - current_time), + Timestamp::Micros(*next_time_us) - current_time), [this]() { RTC_DCHECK_RUN_ON(task_queue_); Timestamp current_time = clock_->CurrentTime(); @@ -52,7 +52,7 @@ void LinkEmulation::OnPacketReceived(EmulatedIpPacket packet) { return TimeDelta::Zero(); // This is ignored. } RTC_DCHECK_GE(*next_time_us, current_time.us()); - return Timestamp::us(*next_time_us) - current_time; + return Timestamp::Micros(*next_time_us) - current_time; }); }); } @@ -74,7 +74,7 @@ void LinkEmulation::Process(Timestamp at_time) { if (delivery_info.receive_time_us != PacketDeliveryInfo::kNotReceived) { packet->packet.arrival_time = - Timestamp::us(delivery_info.receive_time_us); + Timestamp::Micros(delivery_info.receive_time_us); receiver_->OnPacketReceived(std::move(packet->packet)); } while (!packets_.empty() && packets_.front().removed) { diff --git a/test/network/network_emulation_manager.cc b/test/network/network_emulation_manager.cc index 3be1185710..adc4bb646c 100644 --- a/test/network/network_emulation_manager.cc +++ b/test/network/network_emulation_manager.cc @@ -36,7 +36,7 @@ std::unique_ptr CreateTimeController(TimeMode mode) { case TimeMode::kSimulated: // Using an offset of 100000 to get nice fixed width and readable // timestamps in typical test scenarios. - const Timestamp kSimulatedStartTime = Timestamp::seconds(100000); + const Timestamp kSimulatedStartTime = Timestamp::Seconds(100000); return std::make_unique( kSimulatedStartTime); } diff --git a/test/network/network_emulation_unittest.cc b/test/network/network_emulation_unittest.cc index 70dfa77930..58346abb93 100644 --- a/test/network/network_emulation_unittest.cc +++ b/test/network/network_emulation_unittest.cc @@ -28,8 +28,8 @@ namespace webrtc { namespace test { namespace { -constexpr TimeDelta kNetworkPacketWaitTimeout = TimeDelta::Millis<100>(); -constexpr TimeDelta kStatsWaitTimeout = TimeDelta::Seconds<1>(); +constexpr TimeDelta kNetworkPacketWaitTimeout = TimeDelta::Millis(100); +constexpr TimeDelta kStatsWaitTimeout = TimeDelta::Seconds(1); constexpr int kOverheadIpv4Udp = 20 + 8; class SocketReader : public sigslot::has_slots<> { @@ -233,7 +233,7 @@ TEST(NetworkEmulationManagerTest, Run) { [&]() { s2->Send(data.data(), data.size()); }); } - network_manager.time_controller()->AdvanceTime(TimeDelta::seconds(1)); + network_manager.time_controller()->AdvanceTime(TimeDelta::Seconds(1)); EXPECT_EQ(r1.ReceivedCount(), 1000); EXPECT_EQ(r2.ReceivedCount(), 1000); @@ -315,7 +315,7 @@ TEST(NetworkEmulationManagerTest, ThroughputStats) { // Send 11 packets, totalizing 1 second between the first and the last. const int kNumPacketsSent = 11; - const TimeDelta kDelay = TimeDelta::ms(100); + const TimeDelta kDelay = TimeDelta::Millis(100); for (int i = 0; i < kNumPacketsSent; i++) { t1->PostTask(RTC_FROM_HERE, [&]() { s1->Send(data.data(), data.size()); }); t2->PostTask(RTC_FROM_HERE, [&]() { s2->Send(data.data(), data.size()); }); diff --git a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc index fcef1fea3e..13db2b4adf 100644 --- a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc +++ b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc @@ -208,7 +208,7 @@ void DefaultVideoQualityAnalyzer::OnFramePreDecode( return a.receive_time_ms() < b.receive_time_ms(); }) ->receive_time_ms(); - it->second.received_time = Timestamp::ms(last_receive_time); + it->second.received_time = Timestamp::Millis(last_receive_time); } void DefaultVideoQualityAnalyzer::OnFrameDecoded( diff --git a/test/pc/e2e/peer_connection_e2e_smoke_test.cc b/test/pc/e2e/peer_connection_e2e_smoke_test.cc index 6c78bbf6a0..105f4d0021 100644 --- a/test/pc/e2e/peer_connection_e2e_smoke_test.cc +++ b/test/pc/e2e/peer_connection_e2e_smoke_test.cc @@ -81,7 +81,7 @@ class PeerConnectionE2EQualityTestSmokeTest : public ::testing::Test { auto fixture = CreatePeerConnectionE2EQualityTestFixture( test_case_name, /*audio_quality_analyzer=*/nullptr, std::move(video_quality_analyzer)); - fixture->ExecuteAt(TimeDelta::seconds(2), + fixture->ExecuteAt(TimeDelta::Seconds(2), [alice_network_behavior_ptr](TimeDelta) { BuiltInNetworkBehaviorConfig config; config.loss_percent = 5; @@ -134,7 +134,7 @@ class PeerConnectionE2EQualityTestSmokeTest : public ::testing::Test { #define MAYBE_Smoke Smoke #endif TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Smoke) { - RunParams run_params(TimeDelta::seconds(7)); + RunParams run_params(TimeDelta::Seconds(7)); run_params.video_codecs = { VideoCodecConfig(cricket::kVp9CodecName, {{"profile-id", "0"}})}; run_params.use_flex_fec = true; @@ -167,9 +167,9 @@ TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Smoke) { VideoConfig screenshare(640, 360, 30); screenshare.stream_label = "bob-screenshare"; screenshare.screen_share_config = - ScreenShareConfig(TimeDelta::seconds(2)); + ScreenShareConfig(TimeDelta::Seconds(2)); screenshare.screen_share_config->scrolling_params = ScrollingParams( - TimeDelta::ms(1800), kDefaultSlidesWidth, kDefaultSlidesHeight); + TimeDelta::Millis(1800), kDefaultSlidesWidth, kDefaultSlidesHeight); bob->AddVideoConfig(screenshare); AudioConfig audio; @@ -188,7 +188,7 @@ TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Smoke) { #define MAYBE_Echo Echo #endif TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Echo) { - RunParams run_params(TimeDelta::seconds(7)); + RunParams run_params(TimeDelta::Seconds(7)); run_params.echo_emulation_config = EchoEmulationConfig(); RunTest( "smoke", run_params, @@ -218,7 +218,7 @@ TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Echo) { #define MAYBE_Simulcast Simulcast #endif TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Simulcast) { - RunParams run_params(TimeDelta::seconds(7)); + RunParams run_params(TimeDelta::Seconds(7)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; RunTest( "simulcast", run_params, @@ -256,7 +256,7 @@ TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Simulcast) { #define MAYBE_Svc Svc #endif TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Svc) { - RunParams run_params(TimeDelta::seconds(7)); + RunParams run_params(TimeDelta::Seconds(7)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp9CodecName)}; RunTest( "simulcast", run_params, @@ -296,7 +296,7 @@ TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_Svc) { #define MAYBE_HighBitrate HighBitrate #endif TEST_F(PeerConnectionE2EQualityTestSmokeTest, MAYBE_HighBitrate) { - RunParams run_params(TimeDelta::seconds(7)); + RunParams run_params(TimeDelta::Seconds(7)); run_params.video_codecs = { VideoCodecConfig(cricket::kVp9CodecName, {{"profile-id", "0"}})}; diff --git a/test/pc/e2e/peer_connection_quality_test.cc b/test/pc/e2e/peer_connection_quality_test.cc index e5667e6ff1..79af0ddc71 100644 --- a/test/pc/e2e/peer_connection_quality_test.cc +++ b/test/pc/e2e/peer_connection_quality_test.cc @@ -55,9 +55,9 @@ constexpr int kPeerConnectionUsedThreads = 7; constexpr int kFrameworkUsedThreads = 2; constexpr int kMaxVideoAnalyzerThreads = 8; -constexpr TimeDelta kStatsUpdateInterval = TimeDelta::Seconds<1>(); +constexpr TimeDelta kStatsUpdateInterval = TimeDelta::Seconds(1); -constexpr TimeDelta kAliveMessageLogInterval = TimeDelta::Seconds<30>(); +constexpr TimeDelta kAliveMessageLogInterval = TimeDelta::Seconds(30); constexpr int kQuickTestModeRunDurationMs = 100; diff --git a/test/peer_scenario/peer_scenario.h b/test/peer_scenario/peer_scenario.h index 8d6ad1b00c..eeade99cf4 100644 --- a/test/peer_scenario/peer_scenario.h +++ b/test/peer_scenario/peer_scenario.h @@ -87,7 +87,7 @@ class PeerScenario { // Waits on |event| while processing messages on the signaling thread. bool WaitAndProcess(std::atomic* event, - TimeDelta max_duration = TimeDelta::seconds(5)); + TimeDelta max_duration = TimeDelta::Seconds(5)); // Process messages on the signaling thread for the given duration. void ProcessMessages(TimeDelta duration); diff --git a/test/peer_scenario/tests/peer_scenario_quality_test.cc b/test/peer_scenario/tests/peer_scenario_quality_test.cc index 16ba707e1c..d5b763c971 100644 --- a/test/peer_scenario/tests/peer_scenario_quality_test.cc +++ b/test/peer_scenario/tests/peer_scenario_quality_test.cc @@ -27,7 +27,7 @@ TEST(PeerScenarioQualityTest, PsnrIsCollected) { s.AttachVideoQualityAnalyzer(&analyzer, video.track, callee); s.SimpleConnection(caller, callee, {link_builder.Build().node}, {link_builder.Build().node}); - s.ProcessMessages(TimeDelta::seconds(2)); + s.ProcessMessages(TimeDelta::Seconds(2)); // Exit scope to ensure that there's no pending tasks reporting to analyzer. } diff --git a/test/scenario/audio_stream.cc b/test/scenario/audio_stream.cc index 2738f6952c..577b9352ff 100644 --- a/test/scenario/audio_stream.cc +++ b/test/scenario/audio_stream.cc @@ -79,7 +79,7 @@ SendAudioStream::SendAudioStream( SdpAudioFormat::Parameters sdp_params; if (config.source.channels == 2) sdp_params["stereo"] = "1"; - if (config.encoder.initial_frame_length != TimeDelta::ms(20)) + if (config.encoder.initial_frame_length != TimeDelta::Millis(20)) sdp_params["ptime"] = std::to_string(config.encoder.initial_frame_length.ms()); if (config.encoder.enable_dtx) diff --git a/test/scenario/performance_stats_unittest.cc b/test/scenario/performance_stats_unittest.cc index 93ab1a109a..8d87c87745 100644 --- a/test/scenario/performance_stats_unittest.cc +++ b/test/scenario/performance_stats_unittest.cc @@ -17,10 +17,10 @@ namespace test { TEST(EventRateCounter, ReturnsCorrectTotalDuration) { EventRateCounter event_rate_counter; EXPECT_EQ(event_rate_counter.TotalDuration(), TimeDelta::Zero()); - event_rate_counter.AddEvent(Timestamp::seconds(1)); + event_rate_counter.AddEvent(Timestamp::Seconds(1)); EXPECT_EQ(event_rate_counter.TotalDuration(), TimeDelta::Zero()); - event_rate_counter.AddEvent(Timestamp::seconds(2)); - EXPECT_EQ(event_rate_counter.TotalDuration(), TimeDelta::seconds(1)); + event_rate_counter.AddEvent(Timestamp::Seconds(2)); + EXPECT_EQ(event_rate_counter.TotalDuration(), TimeDelta::Seconds(1)); } } // namespace test diff --git a/test/scenario/scenario_config.h b/test/scenario/scenario_config.h index 282d47188f..0d1b84516c 100644 --- a/test/scenario/scenario_config.h +++ b/test/scenario/scenario_config.h @@ -47,7 +47,7 @@ struct TransportControllerConfig { DataRate start_rate = DataRate::kbps(300); } rates; NetworkControllerFactoryInterface* cc_factory = nullptr; - TimeDelta state_log_interval = TimeDelta::ms(100); + TimeDelta state_log_interval = TimeDelta::Millis(100); }; struct CallClientConfig { @@ -78,14 +78,14 @@ struct VideoStreamConfig { // Support for explicit frame triggers should be added here if needed. } capture = Capture::kGenerator; struct Slides { - TimeDelta change_interval = TimeDelta::seconds(10); + TimeDelta change_interval = TimeDelta::Seconds(10); struct Generator { int width = 1600; int height = 1200; } generator; struct Images { struct Crop { - TimeDelta scroll_duration = TimeDelta::seconds(0); + TimeDelta scroll_duration = TimeDelta::Seconds(0); absl::optional width; absl::optional height; } crop; @@ -158,7 +158,7 @@ struct VideoStreamConfig { bool packet_feedback = true; bool use_rtx = true; DataRate pad_to_rate = DataRate::Zero(); - TimeDelta nack_history_time = TimeDelta::ms(1000); + TimeDelta nack_history_time = TimeDelta::Millis(1000); bool use_flexfec = false; bool use_ulpfec = false; FecControllerFactoryInterface* fec_controller_factory = nullptr; @@ -200,7 +200,7 @@ struct AudioStreamConfig { absl::optional fixed_rate; absl::optional min_rate; absl::optional max_rate; - TimeDelta initial_frame_length = TimeDelta::ms(20); + TimeDelta initial_frame_length = TimeDelta::Millis(20); } encoder; struct Stream { Stream(); diff --git a/test/scenario/scenario_tests/bbr_performance.cc b/test/scenario/scenario_tests/bbr_performance.cc index 82aba2bf20..bf89e2cee8 100644 --- a/test/scenario/scenario_tests/bbr_performance.cc +++ b/test/scenario/scenario_tests/bbr_performance.cc @@ -41,7 +41,7 @@ struct CallTestConfig { : random_seed("rs", 1), return_traffic("ret"), capacity("bw", DataRate::kbps(300)), - propagation_delay("dl", TimeDelta::ms(100)), + propagation_delay("dl", TimeDelta::Millis(100)), cross_traffic("ct", DataRate::Zero()), delay_noise("dn", TimeDelta::Zero()), loss_rate("pl", 0) {} @@ -196,7 +196,7 @@ TEST_P(BbrScenarioTest, ReceivesVideo) { auto* cross_traffic = s.net()->CreateRandomWalkCrossTraffic( s.net()->CreateTrafficRoute({send_net->node()}), cross_config); - s.CreatePrinter("send.stats.txt", TimeDelta::ms(100), + s.CreatePrinter("send.stats.txt", TimeDelta::Millis(100), {alice->StatsPrinter(), alice_video->send()->StatsPrinter(), cross_traffic->StatsPrinter(), send_net->ConfigPrinter()}); @@ -205,9 +205,9 @@ TEST_P(BbrScenarioTest, ReceivesVideo) { ret_net->ConfigPrinter()}; if (bob_video) return_printers.push_back(bob_video->send()->StatsPrinter()); - s.CreatePrinter("return.stats.txt", TimeDelta::ms(100), return_printers); + s.CreatePrinter("return.stats.txt", TimeDelta::Millis(100), return_printers); - s.RunFor(TimeDelta::ms(kRunTimeMs)); + s.RunFor(TimeDelta::Millis(kRunTimeMs)); } INSTANTIATE_TEST_SUITE_P(Selected, diff --git a/test/scenario/scenario_unittest.cc b/test/scenario/scenario_unittest.cc index c81709f0ef..46622db987 100644 --- a/test/scenario/scenario_unittest.cc +++ b/test/scenario/scenario_unittest.cc @@ -48,12 +48,12 @@ TEST(ScenarioTest, StartsAndStopsWithoutErrors) { s.NetworkDelayedAction({alice_net, bob_net}, 100, [&packet_received] { packet_received = true; }); - s.Every(TimeDelta::ms(10), [alice, bob, &bitrate_changed] { + s.Every(TimeDelta::Millis(10), [alice, bob, &bitrate_changed] { if (alice->GetStats().send_bandwidth_bps != 300000 && bob->GetStats().send_bandwidth_bps != 300000) bitrate_changed = true; }); - s.RunUntil(TimeDelta::seconds(2), TimeDelta::ms(5), + s.RunUntil(TimeDelta::Seconds(2), TimeDelta::Millis(5), [&bitrate_changed, &packet_received] { return packet_received && bitrate_changed; }); @@ -67,7 +67,7 @@ void SetupVideoCall(Scenario& s, VideoQualityAnalyzer* analyzer) { auto* bob = s.CreateClient("bob", call_config); NetworkSimulationConfig network_config; network_config.bandwidth = DataRate::kbps(1000); - network_config.delay = TimeDelta::ms(50); + network_config.delay = TimeDelta::Millis(50); auto alice_net = s.CreateSimulationNode(network_config); auto bob_net = s.CreateSimulationNode(network_config); auto route = s.CreateRoutes(alice, {alice_net}, bob, {bob_net}); @@ -101,7 +101,7 @@ TEST(ScenarioTest, MAYBE_SimTimeEncoding) { { Scenario s("scenario/encode_sim", false); SetupVideoCall(s, &analyzer); - s.RunFor(TimeDelta::seconds(60)); + s.RunFor(TimeDelta::Seconds(60)); } // Regression tests based on previous runs. EXPECT_EQ(analyzer.stats().lost_count, 0); @@ -121,7 +121,7 @@ TEST(ScenarioTest, MAYBE_RealTimeEncoding) { { Scenario s("scenario/encode_real", true); SetupVideoCall(s, &analyzer); - s.RunFor(TimeDelta::seconds(10)); + s.RunFor(TimeDelta::Seconds(10)); } // Regression tests based on previous runs. EXPECT_LT(analyzer.stats().lost_count, 2); @@ -131,7 +131,7 @@ TEST(ScenarioTest, MAYBE_RealTimeEncoding) { TEST(ScenarioTest, SimTimeFakeing) { Scenario s("scenario/encode_sim", false); SetupVideoCall(s, nullptr); - s.RunFor(TimeDelta::seconds(10)); + s.RunFor(TimeDelta::Seconds(10)); } TEST(ScenarioTest, WritesToRtcEventLog) { @@ -139,7 +139,7 @@ TEST(ScenarioTest, WritesToRtcEventLog) { { Scenario s(storage.CreateFactory(), false); SetupVideoCall(s, nullptr); - s.RunFor(TimeDelta::seconds(1)); + s.RunFor(TimeDelta::Seconds(1)); } auto logs = storage.logs(); // We expect that a rtc event log has been created and that it has some data. diff --git a/test/scenario/stats_collection.cc b/test/scenario/stats_collection.cc index 417c55beb7..e42d17ec51 100644 --- a/test/scenario/stats_collection.cc +++ b/test/scenario/stats_collection.cc @@ -122,7 +122,7 @@ void VideoLayerAnalyzer::HandleRenderedFrame(const VideoFramePair& sample) { RTC_DCHECK(sample.render_time.IsFinite()); TimeDelta render_interval = sample.render_time - last_render_time_; TimeDelta mean_interval = stats_.render.frames.interval().Mean(); - if (render_interval > TimeDelta::ms(150) + mean_interval || + if (render_interval > TimeDelta::Millis(150) + mean_interval || render_interval > 3 * mean_interval) { stats_.freeze_duration.AddSample(render_interval); stats_.time_between_freezes.AddSample(last_render_time_ - @@ -137,9 +137,9 @@ void CallStatsCollector::AddStats(Call::Stats sample) { if (sample.send_bandwidth_bps > 0) stats_.target_rate.AddSampleBps(sample.send_bandwidth_bps); if (sample.pacer_delay_ms > 0) - stats_.pacer_delay.AddSample(TimeDelta::ms(sample.pacer_delay_ms)); + stats_.pacer_delay.AddSample(TimeDelta::Millis(sample.pacer_delay_ms)); if (sample.rtt_ms > 0) - stats_.round_trip_time.AddSample(TimeDelta::ms(sample.rtt_ms)); + stats_.round_trip_time.AddSample(TimeDelta::Millis(sample.rtt_ms)); stats_.memory_usage.AddSample(rtc::GetProcessResidentSizeBytes()); } diff --git a/test/scenario/stats_collection_unittest.cc b/test/scenario/stats_collection_unittest.cc index 4159eeac7f..1d8b7df149 100644 --- a/test/scenario/stats_collection_unittest.cc +++ b/test/scenario/stats_collection_unittest.cc @@ -31,7 +31,7 @@ void CreateAnalyzedStream(Scenario* s, {s->CreateSimulationNode(NetworkSimulationConfig())}); auto* video = s->CreateVideoStream(route->forward(), config); auto* audio = s->CreateAudioStream(route->forward(), AudioStreamConfig()); - s->Every(TimeDelta::seconds(1), [=] { + s->Every(TimeDelta::Seconds(1), [=] { collectors->call.AddStats(caller->GetStats()); collectors->audio_receive.AddStats(audio->receive()->GetStats()); collectors->video_send.AddStats(video->send()->GetStats(), s->Now()); @@ -48,7 +48,7 @@ TEST(ScenarioAnalyzerTest, PsnrIsHighWhenNetworkIsGood) { NetworkSimulationConfig good_network; good_network.bandwidth = DataRate::kbps(1000); CreateAnalyzedStream(&s, good_network, &analyzer, &stats); - s.RunFor(TimeDelta::seconds(3)); + s.RunFor(TimeDelta::Seconds(3)); } // This is a change detecting test, the targets are based on previous runs and // might change due to changes in configuration and encoder etc. The main @@ -70,7 +70,7 @@ TEST(ScenarioAnalyzerTest, PsnrIsLowWhenNetworkIsBad) { bad_network.bandwidth = DataRate::kbps(100); bad_network.loss_rate = 0.02; CreateAnalyzedStream(&s, bad_network, &analyzer, &stats); - s.RunFor(TimeDelta::seconds(3)); + s.RunFor(TimeDelta::Seconds(3)); } // This is a change detecting test, the targets are based on previous runs and // might change due to changes in configuration and encoder etc. @@ -87,10 +87,10 @@ TEST(ScenarioAnalyzerTest, CountsCapturedButNotRendered) { { Scenario s; NetworkSimulationConfig long_delays; - long_delays.delay = TimeDelta::seconds(5); + long_delays.delay = TimeDelta::Seconds(5); CreateAnalyzedStream(&s, long_delays, &analyzer, &stats); // Enough time to send frames but not enough to deliver. - s.RunFor(TimeDelta::ms(100)); + s.RunFor(TimeDelta::Millis(100)); } EXPECT_GE(analyzer.stats().capture.count, 1); EXPECT_EQ(analyzer.stats().render.count, 0); diff --git a/test/scenario/video_frame_matcher.cc b/test/scenario/video_frame_matcher.cc index cf682c36a9..20cfb0e96e 100644 --- a/test/scenario/video_frame_matcher.cc +++ b/test/scenario/video_frame_matcher.cc @@ -180,7 +180,7 @@ DecodedFrameTap::DecodedFrameTap(Clock* clock, void DecodedFrameTap::OnFrame(const VideoFrame& frame) { matcher_->OnDecodedFrame(frame, layer_id_, - Timestamp::ms(frame.render_time_ms()), + Timestamp::Millis(frame.render_time_ms()), clock_->CurrentTime()); } diff --git a/test/scenario/video_stream_unittest.cc b/test/scenario/video_stream_unittest.cc index 0789b0d564..1f2cad7e8c 100644 --- a/test/scenario/video_stream_unittest.cc +++ b/test/scenario/video_stream_unittest.cc @@ -22,7 +22,7 @@ using CodecImpl = VideoStreamConfig::Encoder::Implementation; } // namespace TEST(VideoStreamTest, ReceivesFramesFromFileBasedStreams) { - TimeDelta kRunTime = TimeDelta::ms(500); + TimeDelta kRunTime = TimeDelta::Millis(500); std::vector kFrameRates = {15, 30}; std::deque> frame_counts(2); frame_counts[0] = 0; @@ -68,7 +68,7 @@ TEST(VideoStreamTest, ReceivesFramesFromFileBasedStreams) { } TEST(VideoStreamTest, RecievesVp8SimulcastFrames) { - TimeDelta kRunTime = TimeDelta::ms(500); + TimeDelta kRunTime = TimeDelta::Millis(500); int kFrameRate = 30; std::deque> frame_counts(3); @@ -125,7 +125,7 @@ TEST(VideoStreamTest, SendsNacksOnLoss) { {s.CreateSimulationNode(NetworkSimulationConfig())}); // NACK retransmissions are enabled by default. auto video = s.CreateVideoStream(route->forward(), VideoStreamConfig()); - s.RunFor(TimeDelta::seconds(1)); + s.RunFor(TimeDelta::Seconds(1)); int retransmit_packets = 0; for (const auto& substream : video->send()->GetStats().substreams) { retransmit_packets += substream.second.rtp_stats.retransmitted.packets; @@ -139,7 +139,7 @@ TEST(VideoStreamTest, SendsFecWithUlpFec) { s.CreateRoutes(s.CreateClient("caller", CallClientConfig()), {s.CreateSimulationNode([](NetworkSimulationConfig* c) { c->loss_rate = 0.1; - c->delay = TimeDelta::ms(100); + c->delay = TimeDelta::Millis(100); })}, s.CreateClient("callee", CallClientConfig()), {s.CreateSimulationNode(NetworkSimulationConfig())}); @@ -148,7 +148,7 @@ TEST(VideoStreamTest, SendsFecWithUlpFec) { c->encoder.codec = VideoStreamConfig::Encoder::Codec::kVideoCodecVP8; c->stream.use_ulpfec = true; }); - s.RunFor(TimeDelta::seconds(5)); + s.RunFor(TimeDelta::Seconds(5)); VideoSendStream::Stats video_stats = video->send()->GetStats(); EXPECT_GT(video_stats.substreams.begin()->second.rtp_stats.fec.packets, 0u); } @@ -158,14 +158,14 @@ TEST(VideoStreamTest, SendsFecWithFlexFec) { s.CreateRoutes(s.CreateClient("caller", CallClientConfig()), {s.CreateSimulationNode([](NetworkSimulationConfig* c) { c->loss_rate = 0.1; - c->delay = TimeDelta::ms(100); + c->delay = TimeDelta::Millis(100); })}, s.CreateClient("callee", CallClientConfig()), {s.CreateSimulationNode(NetworkSimulationConfig())}); auto video = s.CreateVideoStream(route->forward(), [&](VideoStreamConfig* c) { c->stream.use_flexfec = true; }); - s.RunFor(TimeDelta::seconds(5)); + s.RunFor(TimeDelta::Seconds(5)); VideoSendStream::Stats video_stats = video->send()->GetStats(); EXPECT_GT(video_stats.substreams.begin()->second.rtp_stats.fec.packets, 0u); } diff --git a/test/time_controller/external_time_controller_unittest.cc b/test/time_controller/external_time_controller_unittest.cc index d93b42aaac..684009fea5 100644 --- a/test/time_controller/external_time_controller_unittest.cc +++ b/test/time_controller/external_time_controller_unittest.cc @@ -29,7 +29,7 @@ using ::testing::Invoke; using ::testing::MockFunction; using ::testing::NiceMock; using ::testing::Return; -constexpr Timestamp kStartTime = Timestamp::Seconds<1000>(); +constexpr Timestamp kStartTime = Timestamp::Seconds(1000); class FakeAlarm : public ControlledAlarmClock { public: @@ -82,8 +82,8 @@ void FakeAlarm::Sleep(TimeDelta duration) { } // namespace TEST(ExternalTimeControllerTest, TaskIsStoppedOnStop) { - const TimeDelta kShortInterval = TimeDelta::ms(5); - const TimeDelta kLongInterval = TimeDelta::ms(20); + const TimeDelta kShortInterval = TimeDelta::Millis(5); + const TimeDelta kLongInterval = TimeDelta::Millis(20); const int kShortIntervalCount = 4; const int kMargin = 1; FakeAlarm alarm(kStartTime); @@ -123,10 +123,10 @@ TEST(ExternalTimeControllerTest, TaskCanStopItself) { handle = RepeatingTaskHandle::Start(task_queue.Get(), [&] { ++counter; handle.Stop(); - return TimeDelta::ms(2); + return TimeDelta::Millis(2); }); }); - time_simulation.AdvanceTime(TimeDelta::ms(10)); + time_simulation.AdvanceTime(TimeDelta::Millis(10)); EXPECT_EQ(counter.load(), 1); } @@ -160,7 +160,7 @@ TEST(ExternalTimeControllerTest, TasksYieldToEachOther) { EXPECT_TRUE(event.Wait(200)); }); - time_simulation.AdvanceTime(TimeDelta::ms(300)); + time_simulation.AdvanceTime(TimeDelta::Millis(300)); } TEST(ExternalTimeControllerTest, CurrentTaskQueue) { @@ -173,7 +173,7 @@ TEST(ExternalTimeControllerTest, CurrentTaskQueue) { task_queue.PostTask([&] { EXPECT_TRUE(task_queue.IsCurrent()); }); - time_simulation.AdvanceTime(TimeDelta::ms(10)); + time_simulation.AdvanceTime(TimeDelta::Millis(10)); } } // namespace webrtc diff --git a/test/time_controller/simulated_process_thread.cc b/test/time_controller/simulated_process_thread.cc index 540e061fa4..0da52dad31 100644 --- a/test/time_controller/simulated_process_thread.cc +++ b/test/time_controller/simulated_process_thread.cc @@ -163,7 +163,7 @@ void SimulatedProcessThread::PostTask(std::unique_ptr task) { Timestamp SimulatedProcessThread::GetNextTime(Module* module, Timestamp at_time) { CurrentTaskQueueSetter set_current(this); - return at_time + TimeDelta::ms(module->TimeUntilNextProcess()); + return at_time + TimeDelta::Millis(module->TimeUntilNextProcess()); } } // namespace webrtc diff --git a/test/time_controller/simulated_task_queue.cc b/test/time_controller/simulated_task_queue.cc index 1f214efcb3..6bc96c73b9 100644 --- a/test/time_controller/simulated_task_queue.cc +++ b/test/time_controller/simulated_task_queue.cc @@ -73,7 +73,8 @@ void SimulatedTaskQueue::PostTask(std::unique_ptr task) { void SimulatedTaskQueue::PostDelayedTask(std::unique_ptr task, uint32_t milliseconds) { rtc::CritScope lock(&lock_); - Timestamp target_time = handler_->CurrentTime() + TimeDelta::ms(milliseconds); + Timestamp target_time = + handler_->CurrentTime() + TimeDelta::Millis(milliseconds); delayed_tasks_[target_time].push_back(std::move(task)); next_run_time_ = std::min(next_run_time_, target_time); } diff --git a/test/time_controller/simulated_thread.cc b/test/time_controller/simulated_thread.cc index 937fe3207e..8d1637c352 100644 --- a/test/time_controller/simulated_thread.cc +++ b/test/time_controller/simulated_thread.cc @@ -63,7 +63,7 @@ void SimulatedThread::RunReady(Timestamp at_time) { if (delay_ms == kForever) { next_run_time_ = Timestamp::PlusInfinity(); } else { - next_run_time_ = at_time + TimeDelta::ms(delay_ms); + next_run_time_ = at_time + TimeDelta::Millis(delay_ms); } } @@ -107,7 +107,7 @@ void SimulatedThread::PostDelayed(const rtc::Location& posted_from, rtc::Thread::PostDelayed(posted_from, delay_ms, phandler, id, pdata); rtc::CritScope lock(&lock_); next_run_time_ = - std::min(next_run_time_, Timestamp::ms(rtc::TimeMillis() + delay_ms)); + std::min(next_run_time_, Timestamp::Millis(rtc::TimeMillis() + delay_ms)); } void SimulatedThread::PostAt(const rtc::Location& posted_from, @@ -117,7 +117,7 @@ void SimulatedThread::PostAt(const rtc::Location& posted_from, rtc::MessageData* pdata) { rtc::Thread::PostAt(posted_from, target_time_ms, phandler, id, pdata); rtc::CritScope lock(&lock_); - next_run_time_ = std::min(next_run_time_, Timestamp::ms(target_time_ms)); + next_run_time_ = std::min(next_run_time_, Timestamp::Millis(target_time_ms)); } void SimulatedThread::Stop() { diff --git a/test/time_controller/simulated_time_controller_unittest.cc b/test/time_controller/simulated_time_controller_unittest.cc index 2fe4bd2df2..e5f704c43f 100644 --- a/test/time_controller/simulated_time_controller_unittest.cc +++ b/test/time_controller/simulated_time_controller_unittest.cc @@ -29,12 +29,12 @@ using ::testing::Invoke; using ::testing::MockFunction; using ::testing::NiceMock; using ::testing::Return; -constexpr Timestamp kStartTime = Timestamp::Seconds<1000>(); +constexpr Timestamp kStartTime = Timestamp::Seconds(1000); } // namespace TEST(SimulatedTimeControllerTest, TaskIsStoppedOnStop) { - const TimeDelta kShortInterval = TimeDelta::ms(5); - const TimeDelta kLongInterval = TimeDelta::ms(20); + const TimeDelta kShortInterval = TimeDelta::Millis(5); + const TimeDelta kLongInterval = TimeDelta::Millis(20); const int kShortIntervalCount = 4; const int kMargin = 1; GlobalSimulatedTimeController time_simulation(kStartTime); @@ -72,10 +72,10 @@ TEST(SimulatedTimeControllerTest, TaskCanStopItself) { handle = RepeatingTaskHandle::Start(task_queue.Get(), [&] { ++counter; handle.Stop(); - return TimeDelta::ms(2); + return TimeDelta::Millis(2); }); }); - time_simulation.AdvanceTime(TimeDelta::ms(10)); + time_simulation.AdvanceTime(TimeDelta::Millis(10)); EXPECT_EQ(counter.load(), 1); } @@ -83,7 +83,7 @@ TEST(SimulatedTimeControllerTest, Example) { class ObjectOnTaskQueue { public: void DoPeriodicTask() {} - TimeDelta TimeUntilNextRun() { return TimeDelta::ms(100); } + TimeDelta TimeUntilNextRun() { return TimeDelta::Millis(100); } void StartPeriodicTask(RepeatingTaskHandle* handle, rtc::TaskQueue* task_queue) { *handle = RepeatingTaskHandle::Start(task_queue->Get(), [this] { @@ -123,7 +123,7 @@ TEST(SimulatedTimeControllerTest, DelayTaskRunOnTime) { bool delay_task_executed = false; task_queue.PostDelayedTask([&] { delay_task_executed = true; }, 10); - time_simulation.AdvanceTime(TimeDelta::ms(10)); + time_simulation.AdvanceTime(TimeDelta::Millis(10)); EXPECT_TRUE(delay_task_executed); } @@ -145,7 +145,7 @@ TEST(SimulatedTimeControllerTest, ThreadYeildsOnInvoke) { // Since we are doing an invoke from the main thread, we don't expect the main // thread message loop to be processed. EXPECT_FALSE(task_has_run); - sim.AdvanceTime(TimeDelta::seconds(1)); + sim.AdvanceTime(TimeDelta::Seconds(1)); ASSERT_TRUE(task_has_run); } diff --git a/video/encoder_bitrate_adjuster_unittest.cc b/video/encoder_bitrate_adjuster_unittest.cc index b7cdfd35f2..4a018c538d 100644 --- a/video/encoder_bitrate_adjuster_unittest.cc +++ b/video/encoder_bitrate_adjuster_unittest.cc @@ -106,7 +106,7 @@ class EncoderBitrateAdjusterTest : public ::testing::Test { const int64_t start_us = rtc::TimeMicros(); while (rtc::TimeMicros() < start_us + (duration_ms * rtc::kNumMicrosecsPerMillisec)) { - clock_.AdvanceTime(TimeDelta::seconds(1) / target_framerate_fps_); + clock_.AdvanceTime(TimeDelta::Seconds(1) / target_framerate_fps_); for (size_t si = 0; si < NumSpatialLayers(); ++si) { const std::vector& tl_pattern = kTlPatterns[NumTemporalLayers(si) - 1]; diff --git a/video/encoder_overshoot_detector_unittest.cc b/video/encoder_overshoot_detector_unittest.cc index 7170f49061..90528e45cc 100644 --- a/video/encoder_overshoot_detector_unittest.cc +++ b/video/encoder_overshoot_detector_unittest.cc @@ -40,14 +40,14 @@ class EncoderOvershootDetectorTest : public ::testing::Test { if (rtc::TimeMillis() == 0) { // Encode a first frame which by definition has no overuse factor. detector_.OnEncodedFrame(frame_size_bytes, rtc::TimeMillis()); - clock_.AdvanceTime(TimeDelta::seconds(1) / target_framerate_fps_); + clock_.AdvanceTime(TimeDelta::Seconds(1) / target_framerate_fps_); } int64_t runtime_us = 0; while (runtime_us < test_duration_ms * 1000) { detector_.OnEncodedFrame(frame_size_bytes, rtc::TimeMillis()); runtime_us += rtc::kNumMicrosecsPerSec / target_framerate_fps_; - clock_.AdvanceTime(TimeDelta::seconds(1) / target_framerate_fps_); + clock_.AdvanceTime(TimeDelta::Seconds(1) / target_framerate_fps_); } // At constant utilization, both network and media utilization should be @@ -81,7 +81,7 @@ TEST_F(EncoderOvershootDetectorTest, NoUtilizationIfNoRate) { detector_.GetNetworkRateUtilizationFactor(rtc::TimeMillis()).has_value()); detector_.OnEncodedFrame(frame_size_bytes, rtc::TimeMillis()); - clock_.AdvanceTime(TimeDelta::ms(time_interval_ms)); + clock_.AdvanceTime(TimeDelta::Millis(time_interval_ms)); EXPECT_TRUE( detector_.GetNetworkRateUtilizationFactor(rtc::TimeMillis()).has_value()); } @@ -147,7 +147,7 @@ TEST_F(EncoderOvershootDetectorTest, PartialOvershoot) { int i = 0; while (runtime_us < kWindowSizeMs * rtc::kNumMicrosecsPerMillisec) { runtime_us += rtc::kNumMicrosecsPerSec / target_framerate_fps_; - clock_.AdvanceTime(TimeDelta::seconds(1) / target_framerate_fps_); + clock_.AdvanceTime(TimeDelta::Seconds(1) / target_framerate_fps_); int frame_size_bytes = (i++ % 4 < 2) ? (ideal_frame_size_bytes * 120) / 100 : (ideal_frame_size_bytes * 80) / 100; detector_.OnEncodedFrame(frame_size_bytes, rtc::TimeMillis()); diff --git a/video/overuse_frame_detector.cc b/video/overuse_frame_detector.cc index 1046c1ea3f..9508470e54 100644 --- a/video/overuse_frame_detector.cc +++ b/video/overuse_frame_detector.cc @@ -549,10 +549,10 @@ void OveruseFrameDetector::StartCheckForOveruse( SetOptions(options); check_overuse_task_ = RepeatingTaskHandle::DelayedStart( - task_queue_base, TimeDelta::ms(kTimeToFirstCheckForOveruseMs), + task_queue_base, TimeDelta::Millis(kTimeToFirstCheckForOveruseMs), [this, overuse_observer] { CheckForOveruse(overuse_observer); - return TimeDelta::ms(kCheckForOveruseIntervalMs); + return TimeDelta::Millis(kCheckForOveruseIntervalMs); }); } void OveruseFrameDetector::StopCheckForOveruse() { diff --git a/video/overuse_frame_detector_unittest.cc b/video/overuse_frame_detector_unittest.cc index ad6119007b..d77d4dcdfc 100644 --- a/video/overuse_frame_detector_unittest.cc +++ b/video/overuse_frame_detector_unittest.cc @@ -109,10 +109,10 @@ class OveruseFrameDetectorTest : public ::testing::Test, frame.set_timestamp(timestamp); int64_t capture_time_us = rtc::TimeMicros(); overuse_detector_->FrameCaptured(frame, capture_time_us); - clock_.AdvanceTime(TimeDelta::us(delay_us)); + clock_.AdvanceTime(TimeDelta::Micros(delay_us)); overuse_detector_->FrameSent(timestamp, rtc::TimeMicros(), capture_time_us, delay_us); - clock_.AdvanceTime(TimeDelta::us(interval_us - delay_us)); + clock_.AdvanceTime(TimeDelta::Micros(interval_us - delay_us)); timestamp += interval_us * 90 / 1000; } } @@ -138,7 +138,7 @@ class OveruseFrameDetectorTest : public ::testing::Test, int max_delay_us = 0; for (int delay_us : delays_us) { if (delay_us > max_delay_us) { - clock_.AdvanceTime(TimeDelta::us(delay_us - max_delay_us)); + clock_.AdvanceTime(TimeDelta::Micros(delay_us - max_delay_us)); max_delay_us = delay_us; } @@ -146,7 +146,7 @@ class OveruseFrameDetectorTest : public ::testing::Test, capture_time_us, delay_us); } overuse_detector_->CheckForOveruse(observer_); - clock_.AdvanceTime(TimeDelta::us(interval_us - max_delay_us)); + clock_.AdvanceTime(TimeDelta::Micros(interval_us - max_delay_us)); timestamp += interval_us * 90 / 1000; } } @@ -171,7 +171,7 @@ class OveruseFrameDetectorTest : public ::testing::Test, int interval_us = random.Rand(min_interval_us, max_interval_us); int64_t capture_time_us = rtc::TimeMicros(); overuse_detector_->FrameCaptured(frame, capture_time_us); - clock_.AdvanceTime(TimeDelta::us(delay_us)); + clock_.AdvanceTime(TimeDelta::Micros(delay_us)); overuse_detector_->FrameSent(timestamp, rtc::TimeMicros(), capture_time_us, absl::optional(delay_us)); @@ -179,7 +179,7 @@ class OveruseFrameDetectorTest : public ::testing::Test, overuse_detector_->CheckForOveruse(observer_); // Avoid turning clock backwards. if (interval_us > delay_us) - clock_.AdvanceTime(TimeDelta::us(interval_us - delay_us)); + clock_.AdvanceTime(TimeDelta::Micros(interval_us - delay_us)); timestamp += interval_us * 90 / 1000; } @@ -276,7 +276,7 @@ TEST_F(OveruseFrameDetectorTest, TriggerUnderuseWithMinProcessCount) { kProcessTimeUs); overuse_detector_->CheckForOveruse(&overuse_observer); EXPECT_EQ(0, overuse_observer.normaluse_); - clock_.AdvanceTime(TimeDelta::us(kProcessIntervalUs)); + clock_.AdvanceTime(TimeDelta::Micros(kProcessIntervalUs)); overuse_detector_->CheckForOveruse(&overuse_observer); EXPECT_EQ(1, overuse_observer.normaluse_); } @@ -352,14 +352,14 @@ TEST_F(OveruseFrameDetectorTest, MinFrameSamplesBeforeUpdating) { kProcessTimeUs); EXPECT_EQ(InitialUsage(), UsagePercent()); // Pass time far enough to digest all previous samples. - clock_.AdvanceTime(TimeDelta::seconds(1)); + clock_.AdvanceTime(TimeDelta::Seconds(1)); InsertAndSendFramesWithInterval(1, kFrameIntervalUs, kWidth, kHeight, kProcessTimeUs); // The last sample has not been processed here. EXPECT_EQ(InitialUsage(), UsagePercent()); // Pass time far enough to digest all previous samples, 41 in total. - clock_.AdvanceTime(TimeDelta::seconds(1)); + clock_.AdvanceTime(TimeDelta::Seconds(1)); InsertAndSendFramesWithInterval(1, kFrameIntervalUs, kWidth, kHeight, kProcessTimeUs); EXPECT_NE(InitialUsage(), UsagePercent()); @@ -387,7 +387,7 @@ TEST_F(OveruseFrameDetectorTest, MeasuresMultipleConcurrentSamples) { frame.set_timestamp(static_cast(i)); int64_t capture_time_us = rtc::TimeMicros(); overuse_detector_->FrameCaptured(frame, capture_time_us); - clock_.AdvanceTime(TimeDelta::us(kIntervalUs)); + clock_.AdvanceTime(TimeDelta::Micros(kIntervalUs)); if (i > kNumFramesEncodingDelay) { overuse_detector_->FrameSent( static_cast(i - kNumFramesEncodingDelay), rtc::TimeMicros(), @@ -415,14 +415,14 @@ TEST_F(OveruseFrameDetectorTest, UpdatesExistingSamples) { int64_t capture_time_us = rtc::TimeMicros(); overuse_detector_->FrameCaptured(frame, capture_time_us); // Encode and send first parts almost instantly. - clock_.AdvanceTime(TimeDelta::ms(1)); + clock_.AdvanceTime(TimeDelta::Millis(1)); overuse_detector_->FrameSent(timestamp, rtc::TimeMicros(), capture_time_us, rtc::kNumMicrosecsPerMillisec); // Encode heavier part, resulting in >85% usage total. - clock_.AdvanceTime(TimeDelta::us(kDelayUs) - TimeDelta::ms(1)); + clock_.AdvanceTime(TimeDelta::Micros(kDelayUs) - TimeDelta::Millis(1)); overuse_detector_->FrameSent(timestamp, rtc::TimeMicros(), capture_time_us, kDelayUs); - clock_.AdvanceTime(TimeDelta::us(kIntervalUs - kDelayUs)); + clock_.AdvanceTime(TimeDelta::Micros(kIntervalUs - kDelayUs)); timestamp += kIntervalUs * 90 / 1000; overuse_detector_->CheckForOveruse(observer_); } @@ -681,7 +681,7 @@ class OveruseFrameDetectorTest2 : public OveruseFrameDetectorTest { overuse_detector_->FrameSent(0 /* ignored timestamp */, 0 /* ignored send_time_us */, capture_time_us, delay_us); - clock_.AdvanceTime(TimeDelta::us(interval_us)); + clock_.AdvanceTime(TimeDelta::Micros(interval_us)); } } @@ -708,7 +708,7 @@ class OveruseFrameDetectorTest2 : public OveruseFrameDetectorTest { capture_time_us, delay_us); overuse_detector_->CheckForOveruse(observer_); - clock_.AdvanceTime(TimeDelta::us(interval_us)); + clock_.AdvanceTime(TimeDelta::Micros(interval_us)); } } @@ -758,7 +758,7 @@ TEST_F(OveruseFrameDetectorTest2, TriggerUnderuseWithMinProcessCount) { kProcessTimeUs); overuse_detector_->CheckForOveruse(&overuse_observer); EXPECT_EQ(0, overuse_observer.normaluse_); - clock_.AdvanceTime(TimeDelta::us(kProcessIntervalUs)); + clock_.AdvanceTime(TimeDelta::Micros(kProcessIntervalUs)); overuse_detector_->CheckForOveruse(&overuse_observer); EXPECT_EQ(1, overuse_observer.normaluse_); } @@ -869,7 +869,7 @@ TEST_F(OveruseFrameDetectorTest2, MeasuresMultipleConcurrentSamples) { frame.set_timestamp(static_cast(i)); int64_t capture_time_us = rtc::TimeMicros(); overuse_detector_->FrameCaptured(frame, capture_time_us); - clock_.AdvanceTime(TimeDelta::us(kIntervalUs)); + clock_.AdvanceTime(TimeDelta::Micros(kIntervalUs)); if (i > kNumFramesEncodingDelay) { overuse_detector_->FrameSent( static_cast(i - kNumFramesEncodingDelay), rtc::TimeMicros(), @@ -897,14 +897,14 @@ TEST_F(OveruseFrameDetectorTest2, UpdatesExistingSamples) { int64_t capture_time_us = rtc::TimeMicros(); overuse_detector_->FrameCaptured(frame, capture_time_us); // Encode and send first parts almost instantly. - clock_.AdvanceTime(TimeDelta::ms(1)); + clock_.AdvanceTime(TimeDelta::Millis(1)); overuse_detector_->FrameSent(timestamp, rtc::TimeMicros(), capture_time_us, rtc::kNumMicrosecsPerMillisec); // Encode heavier part, resulting in >85% usage total. - clock_.AdvanceTime(TimeDelta::us(kDelayUs) - TimeDelta::ms(1)); + clock_.AdvanceTime(TimeDelta::Micros(kDelayUs) - TimeDelta::Millis(1)); overuse_detector_->FrameSent(timestamp, rtc::TimeMicros(), capture_time_us, kDelayUs); - clock_.AdvanceTime(TimeDelta::us(kIntervalUs - kDelayUs)); + clock_.AdvanceTime(TimeDelta::Micros(kIntervalUs - kDelayUs)); timestamp += kIntervalUs * 90 / 1000; overuse_detector_->CheckForOveruse(observer_); } diff --git a/video/pc_full_stack_tests.cc b/video/pc_full_stack_tests.cc index d9915de3d1..54a6c8ade7 100644 --- a/video/pc_full_stack_tests.cc +++ b/video/pc_full_stack_tests.cc @@ -138,7 +138,7 @@ TEST(PCFullStackTest, ForemanCifWithoutPacketLossVp9) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig( /*name=*/cricket::kVp9CodecName, /*required_params=*/{ {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})}; @@ -163,7 +163,7 @@ TEST_P(PCGenericDescriptorTest, ForemanCifPlr5Vp9) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig( /*name=*/cricket::kVp9CodecName, /*required_params=*/{ {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})}; @@ -196,7 +196,7 @@ TEST(PCFullStackTest, MAYBE_GeneratorWithoutPacketLossVp9Profile2) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig( /*name=*/cricket::kVp9CodecName, /*required_params=*/{ {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile2)}})}; @@ -251,7 +251,7 @@ TEST(PCFullStackTest, ParisQcifWithoutPacketLoss) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -272,7 +272,7 @@ TEST_P(PCGenericDescriptorTest, ForemanCifWithoutPacketLoss) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -299,7 +299,7 @@ TEST_P(PCGenericDescriptorTest, ForemanCif30kbpsWithoutPacketLoss) { alice->SetBitrateParameters(bitrate_params); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -331,7 +331,7 @@ TEST_P(PCGenericDescriptorTest, alice->SetBitrateParameters(bitrate_params); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -354,7 +354,7 @@ TEST(PCFullStackTest, ForemanCifLink150kbpsWithoutPacketLoss) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -378,7 +378,7 @@ TEST(PCFullStackTest, ForemanCifLink130kbps100msDelay1PercentPacketLossUlpfec) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = true; @@ -402,7 +402,7 @@ TEST(PCFullStackTest, ForemanCifLink50kbps100msDelay1PercentPacketLossUlpfec) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = true; @@ -427,7 +427,7 @@ TEST(PCFullStackTest, ForemanCifLink150kbpsBadRateController) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -457,7 +457,7 @@ TEST(PCFullStackTest, ForemanCifMediaCapacitySmallLossAndQueue) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -481,7 +481,7 @@ TEST_P(PCGenericDescriptorTest, ForemanCifPlr5) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -504,7 +504,7 @@ TEST_P(PCGenericDescriptorTest, ForemanCifPlr5Ulpfec) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = true; @@ -527,7 +527,7 @@ TEST(PCFullStackTest, ForemanCifPlr5Flexfec) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = true; run_params.use_ulp_fec = false; @@ -551,7 +551,7 @@ TEST(PCFullStackTest, ForemanCif500kbpsPlr3Flexfec) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = true; run_params.use_ulp_fec = false; @@ -575,7 +575,7 @@ TEST(PCFullStackTest, ForemanCif500kbpsPlr3Ulpfec) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = true; @@ -597,7 +597,7 @@ TEST(PCFullStackTest, ForemanCifWithoutPacketlossH264) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kH264CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -624,7 +624,7 @@ TEST(PCFullStackTest, ForemanCif30kbpsWithoutPacketlossH264) { alice->SetBitrateParameters(bitrate_params); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kH264CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -647,7 +647,7 @@ TEST_P(PCGenericDescriptorTest, ForemanCifPlr5H264) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kH264CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -673,7 +673,7 @@ TEST(PCFullStackTest, ForemanCifPlr5H264SpsPpsIdrIsKeyframe) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kH264CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -696,7 +696,7 @@ TEST(PCFullStackTest, ForemanCifPlr5H264Flexfec) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kH264CodecName)}; run_params.use_flex_fec = true; run_params.use_ulp_fec = false; @@ -721,7 +721,7 @@ TEST(PCFullStackTest, DISABLED_ForemanCifPlr5H264Ulpfec) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kH264CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = true; @@ -746,7 +746,7 @@ TEST(PCFullStackTest, ForemanCif500kbps) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -770,7 +770,7 @@ TEST(PCFullStackTest, ForemanCif500kbpsLimitedQueue) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -794,7 +794,7 @@ TEST(PCFullStackTest, ForemanCif500kbps100ms) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -818,7 +818,7 @@ TEST_P(PCGenericDescriptorTest, ForemanCif500kbps100msLimitedQueue) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -863,7 +863,7 @@ TEST(PCFullStackTest, ForemanCif1000kbps100msLimitedQueue) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -889,7 +889,7 @@ TEST(PCFullStackTest, ConferenceMotionHd2000kbps100msLimitedQueue) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -918,7 +918,7 @@ TEST(PCFullStackTest, ConferenceMotionHd1TLModerateLimitsWhitelistVp8) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -1070,7 +1070,7 @@ TEST(PCFullStackTest, ConferenceMotionHd2000kbps100msLimitedQueueVP9) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig( /*name=*/cricket::kVp9CodecName, /*required_params=*/{ {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})}; @@ -1089,12 +1089,12 @@ TEST(PCFullStackTest, ScreenshareSlidesVP8_2TL_NoConferenceMode) { BuiltInNetworkBehaviorConfig()), [](PeerConfigurer* alice) { VideoConfig video(1850, 1110, 5); - video.screen_share_config = ScreenShareConfig(TimeDelta::seconds(10)); + video.screen_share_config = ScreenShareConfig(TimeDelta::Seconds(10)); video.stream_label = "alice-video"; alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -1110,12 +1110,12 @@ TEST(PCFullStackTest, ScreenshareSlidesVP8_2TL) { BuiltInNetworkBehaviorConfig()), [](PeerConfigurer* alice) { VideoConfig video(1850, 1110, 5); - video.screen_share_config = ScreenShareConfig(TimeDelta::seconds(10)); + video.screen_share_config = ScreenShareConfig(TimeDelta::Seconds(10)); video.stream_label = "alice-video"; alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -1134,14 +1134,14 @@ TEST(PCFullStackTest, ScreenshareSlidesVP8_2TL_Simulcast_NoConferenceMode) { BuiltInNetworkBehaviorConfig()), [](PeerConfigurer* alice) { VideoConfig video(1850, 1110, 30); - video.screen_share_config = ScreenShareConfig(TimeDelta::seconds(10)); + video.screen_share_config = ScreenShareConfig(TimeDelta::Seconds(10)); video.simulcast_config = VideoSimulcastConfig(2, 1); video.temporal_layers_count = 2; video.stream_label = "alice-video"; alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -1157,14 +1157,14 @@ TEST(PCFullStackTest, ScreenshareSlidesVP8_2TL_Simulcast) { BuiltInNetworkBehaviorConfig()), [](PeerConfigurer* alice) { VideoConfig video(1850, 1110, 30); - video.screen_share_config = ScreenShareConfig(TimeDelta::seconds(10)); + video.screen_share_config = ScreenShareConfig(TimeDelta::Seconds(10)); video.simulcast_config = VideoSimulcastConfig(2, 1); video.temporal_layers_count = 2; video.stream_label = "alice-video"; alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -1397,12 +1397,12 @@ TEST(PCFullStackTest, ScreenshareSlidesVP9_3SL_High_Fps) { [](PeerConfigurer* alice) { VideoConfig video(1850, 1110, 30); video.stream_label = "alice-video"; - video.screen_share_config = ScreenShareConfig(TimeDelta::seconds(10)); + video.screen_share_config = ScreenShareConfig(TimeDelta::Seconds(10)); video.simulcast_config = VideoSimulcastConfig(3, 2); alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig( /*name=*/cricket::kVp9CodecName, /*required_params=*/{ {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})}; @@ -1427,12 +1427,12 @@ TEST(PCFullStackTest, ScreenshareSlidesVP9_3SL_Variable_Fps) { [](PeerConfigurer* alice) { VideoConfig video(1850, 1110, 30); video.stream_label = "alice-video"; - video.screen_share_config = ScreenShareConfig(TimeDelta::seconds(10)); + video.screen_share_config = ScreenShareConfig(TimeDelta::Seconds(10)); video.simulcast_config = VideoSimulcastConfig(3, 2); alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig( /*name=*/cricket::kVp9CodecName, /*required_params=*/{ {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})}; @@ -1461,7 +1461,7 @@ TEST(PCFullStackTest, VP9SVC_3SL_High) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig( /*name=*/cricket::kVp9CodecName, /*required_params=*/{ {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})}; @@ -1490,7 +1490,7 @@ TEST(PCFullStackTest, VP9SVC_3SL_Medium) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig( /*name=*/cricket::kVp9CodecName, /*required_params=*/{ {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})}; @@ -1519,7 +1519,7 @@ TEST(PCFullStackTest, VP9SVC_3SL_Low) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig( /*name=*/cricket::kVp9CodecName, /*required_params=*/{ {kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})}; @@ -1648,7 +1648,7 @@ TEST(PCFullStackTest, MAYBE_SimulcastFullHdOveruse) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -1673,7 +1673,7 @@ TEST(PCFullStackTest, SimulcastVP8_3SL_High) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -1698,7 +1698,7 @@ TEST(PCFullStackTest, SimulcastVP8_3SL_Medium) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; @@ -1723,7 +1723,7 @@ TEST(PCFullStackTest, SimulcastVP8_3SL_Low) { alice->AddVideoConfig(std::move(video)); }, [](PeerConfigurer* bob) {}); - RunParams run_params(TimeDelta::seconds(kTestDurationSec)); + RunParams run_params(TimeDelta::Seconds(kTestDurationSec)); run_params.video_codecs = {VideoCodecConfig(cricket::kVp8CodecName)}; run_params.use_flex_fec = false; run_params.use_ulp_fec = false; diff --git a/video/receive_statistics_proxy_unittest.cc b/video/receive_statistics_proxy_unittest.cc index 0f0d56ceba..626542c810 100644 --- a/video/receive_statistics_proxy_unittest.cc +++ b/video/receive_statistics_proxy_unittest.cc @@ -189,9 +189,9 @@ TEST_F(ReceiveStatisticsProxyTest, ReportsContentType) { TEST_F(ReceiveStatisticsProxyTest, ReportsMaxTotalInterFrameDelay) { webrtc::VideoFrame frame = CreateFrame(kWidth, kHeight); - const TimeDelta kInterFrameDelay1 = TimeDelta::ms(100); - const TimeDelta kInterFrameDelay2 = TimeDelta::ms(200); - const TimeDelta kInterFrameDelay3 = TimeDelta::ms(300); + const TimeDelta kInterFrameDelay1 = TimeDelta::Millis(100); + const TimeDelta kInterFrameDelay2 = TimeDelta::Millis(200); + const TimeDelta kInterFrameDelay3 = TimeDelta::Millis(300); double expected_total_inter_frame_delay = 0; double expected_total_squared_inter_frame_delay = 0; EXPECT_EQ(expected_total_inter_frame_delay, diff --git a/video/send_statistics_proxy_unittest.cc b/video/send_statistics_proxy_unittest.cc index 2532c29215..db5c94b5cb 100644 --- a/video/send_statistics_proxy_unittest.cc +++ b/video/send_statistics_proxy_unittest.cc @@ -397,7 +397,8 @@ TEST_F(SendStatisticsProxyTest, // TODO(https://crbug.com/webrtc/10640): When the RateTracker uses a Clock // this test can stop relying on rtc::ScopedFakeClock. rtc::ScopedFakeClock fake_global_clock; - fake_global_clock.SetTime(Timestamp::ms(fake_clock_.TimeInMilliseconds())); + fake_global_clock.SetTime( + Timestamp::Millis(fake_clock_.TimeInMilliseconds())); statistics_proxy_->OnSetEncoderTargetRate(kTargetBytesPerSecond * 8); EncodedImage encoded_image; @@ -408,7 +409,8 @@ TEST_F(SendStatisticsProxyTest, statistics_proxy_->GetStats().total_encoded_bytes_target; // Second frame fake_clock_.AdvanceTimeMilliseconds(kInterframeDelayMs); - fake_global_clock.SetTime(Timestamp::ms(fake_clock_.TimeInMilliseconds())); + fake_global_clock.SetTime( + Timestamp::Millis(fake_clock_.TimeInMilliseconds())); encoded_image.SetTimestamp(encoded_image.Timestamp() + 90 * kInterframeDelayMs); statistics_proxy_->OnSendEncodedImage(encoded_image, nullptr); diff --git a/video/video_analyzer.cc b/video/video_analyzer.cc index f2822efbea..e5181126ce 100644 --- a/video/video_analyzer.cc +++ b/video/video_analyzer.cc @@ -38,7 +38,7 @@ ABSL_FLAG(bool, namespace webrtc { namespace { -constexpr TimeDelta kSendStatsPollingInterval = TimeDelta::Seconds<1>(); +constexpr TimeDelta kSendStatsPollingInterval = TimeDelta::Seconds(1); constexpr size_t kMaxComparisons = 10; // How often is keep alive message printed. constexpr int kKeepAliveIntervalSeconds = 30; diff --git a/video/video_receive_stream.cc b/video/video_receive_stream.cc index 7f68f76d2e..4f0dfaf3d0 100644 --- a/video/video_receive_stream.cc +++ b/video/video_receive_stream.cc @@ -101,7 +101,7 @@ class WebRtcRecordableEncodedFrame : public RecordableEncodedFrame { EncodedResolution resolution() const override { return resolution_; } Timestamp render_time() const override { - return Timestamp::ms(render_time_ms_); + return Timestamp::Millis(render_time_ms_); } private: diff --git a/video/video_receive_stream_unittest.cc b/video/video_receive_stream_unittest.cc index 503660eca6..54896e89d8 100644 --- a/video/video_receive_stream_unittest.cc +++ b/video/video_receive_stream_unittest.cc @@ -475,7 +475,7 @@ class VideoReceiveStreamTestWithSimulatedClock : public ::testing::Test { } VideoReceiveStreamTestWithSimulatedClock() - : time_controller_(Timestamp::ms(4711)), + : time_controller_(Timestamp::Millis(4711)), fake_decoder_factory_([this] { return std::make_unique([this] { OnFrameDecoded(); }); }), @@ -523,8 +523,8 @@ class VideoReceiveStreamTestWithSimulatedClock : public ::testing::Test { TEST_F(VideoReceiveStreamTestWithSimulatedClock, RequestsKeyFramesUntilKeyFrameReceived) { - auto tick = - TimeDelta::ms(internal::VideoReceiveStream::kMaxWaitForKeyFrameMs / 2); + auto tick = TimeDelta::Millis( + internal::VideoReceiveStream::kMaxWaitForKeyFrameMs / 2); EXPECT_CALL(mock_transport_, SendRtcp).Times(1); video_receive_stream_.GenerateKeyFrame(); PassEncodedFrameAndWait(MakeFrame(VideoFrameType::kVideoFrameDelta, 0)); diff --git a/video/video_send_stream_impl.cc b/video/video_send_stream_impl.cc index 9ecb36ae92..eaeda96eb5 100644 --- a/video/video_send_stream_impl.cc +++ b/video/video_send_stream_impl.cc @@ -47,7 +47,7 @@ static constexpr int kMaxVbaSizeDifferencePercent = 10; // Max time we will throttle similar video bitrate allocations. static constexpr int64_t kMaxVbaThrottleTimeMs = 500; -constexpr TimeDelta kEncoderTimeOut = TimeDelta::Seconds<2>(); +constexpr TimeDelta kEncoderTimeOut = TimeDelta::Seconds(2); bool TransportSeqNumExtensionConfigured(const VideoSendStream::Config& config) { const std::vector& extensions = config.rtp.extensions; @@ -158,7 +158,7 @@ bool SameStreamsEnabled(const VideoBitrateAllocation& lhs, PacingConfig::PacingConfig() : pacing_factor("factor", PacedSender::kDefaultPaceMultiplier), max_pacing_delay("max_delay", - TimeDelta::ms(PacedSender::kMaxQueueLengthMs)) { + TimeDelta::Millis(PacedSender::kMaxQueueLengthMs)) { ParseFieldTrial({&pacing_factor, &max_pacing_delay}, field_trial::FindFullName("WebRTC-Video-Pacing")); } diff --git a/video/video_send_stream_impl_unittest.cc b/video/video_send_stream_impl_unittest.cc index 06cad22cba..5c8545370e 100644 --- a/video/video_send_stream_impl_unittest.cc +++ b/video/video_send_stream_impl_unittest.cc @@ -699,7 +699,7 @@ TEST_F(VideoSendStreamImplTest, CallsVideoStreamEncoderOnBitrateUpdate) { BitrateAllocationUpdate update; update.target_bitrate = network_constrained_rate; update.stable_target_bitrate = network_constrained_rate; - update.round_trip_time = TimeDelta::ms(1); + update.round_trip_time = TimeDelta::Millis(1); EXPECT_CALL(rtp_video_sender_, OnBitrateUpdated(update, _)); EXPECT_CALL(rtp_video_sender_, GetPayloadBitrateBps()) .WillOnce(Return(network_constrained_rate.bps())); diff --git a/video/video_stream_decoder_impl_unittest.cc b/video/video_stream_decoder_impl_unittest.cc index 37924d11b3..44e914001d 100644 --- a/video/video_stream_decoder_impl_unittest.cc +++ b/video/video_stream_decoder_impl_unittest.cc @@ -156,7 +156,7 @@ class FrameBuilder { class VideoStreamDecoderImplTest : public ::testing::Test { public: VideoStreamDecoderImplTest() - : time_controller_(Timestamp::seconds(0)), + : time_controller_(Timestamp::Seconds(0)), video_stream_decoder_(&callbacks_, &decoder_factory_, time_controller_.GetTaskQueueFactory(), @@ -173,20 +173,20 @@ class VideoStreamDecoderImplTest : public ::testing::Test { TEST_F(VideoStreamDecoderImplTest, InsertAndDecodeFrame) { video_stream_decoder_.OnFrame(FrameBuilder().WithPayloadType(1).Build()); EXPECT_CALL(callbacks_, OnDecodedFrame); - time_controller_.AdvanceTime(TimeDelta::ms(1)); + time_controller_.AdvanceTime(TimeDelta::Millis(1)); } TEST_F(VideoStreamDecoderImplTest, NonDecodableStateWaitingForKeyframe) { EXPECT_CALL(callbacks_, OnNonDecodableState); - time_controller_.AdvanceTime(TimeDelta::ms(200)); + time_controller_.AdvanceTime(TimeDelta::Millis(200)); } TEST_F(VideoStreamDecoderImplTest, NonDecodableStateWaitingForDeltaFrame) { video_stream_decoder_.OnFrame(FrameBuilder().WithPayloadType(1).Build()); EXPECT_CALL(callbacks_, OnDecodedFrame); - time_controller_.AdvanceTime(TimeDelta::ms(1)); + time_controller_.AdvanceTime(TimeDelta::Millis(1)); EXPECT_CALL(callbacks_, OnNonDecodableState); - time_controller_.AdvanceTime(TimeDelta::ms(3000)); + time_controller_.AdvanceTime(TimeDelta::Millis(3000)); } TEST_F(VideoStreamDecoderImplTest, InsertAndDecodeFrameWithKeyframeRequest) { @@ -195,7 +195,7 @@ TEST_F(VideoStreamDecoderImplTest, InsertAndDecodeFrameWithKeyframeRequest) { .WillOnce(Return(WEBRTC_VIDEO_CODEC_OK_REQUEST_KEYFRAME)); EXPECT_CALL(callbacks_, OnDecodedFrame); EXPECT_CALL(callbacks_, OnNonDecodableState); - time_controller_.AdvanceTime(TimeDelta::ms(1)); + time_controller_.AdvanceTime(TimeDelta::Millis(1)); } TEST_F(VideoStreamDecoderImplTest, FailToInitDecoder) { @@ -203,7 +203,7 @@ TEST_F(VideoStreamDecoderImplTest, FailToInitDecoder) { ON_CALL(decoder_factory_.Vp8Decoder(), InitDecode) .WillByDefault(Return(WEBRTC_VIDEO_CODEC_ERROR)); EXPECT_CALL(callbacks_, OnNonDecodableState); - time_controller_.AdvanceTime(TimeDelta::ms(1)); + time_controller_.AdvanceTime(TimeDelta::Millis(1)); } TEST_F(VideoStreamDecoderImplTest, FailToDecodeFrame) { @@ -211,7 +211,7 @@ TEST_F(VideoStreamDecoderImplTest, FailToDecodeFrame) { ON_CALL(decoder_factory_.Vp8Decoder(), DecodeCall) .WillByDefault(Return(WEBRTC_VIDEO_CODEC_ERROR)); EXPECT_CALL(callbacks_, OnNonDecodableState); - time_controller_.AdvanceTime(TimeDelta::ms(1)); + time_controller_.AdvanceTime(TimeDelta::Millis(1)); } TEST_F(VideoStreamDecoderImplTest, ChangeFramePayloadType) { @@ -219,13 +219,13 @@ TEST_F(VideoStreamDecoderImplTest, ChangeFramePayloadType) { FrameBuilder().WithPayloadType(1).WithPictureId(0).Build()); EXPECT_CALL(decoder_factory_.Vp8Decoder(), DecodeCall); EXPECT_CALL(callbacks_, OnDecodedFrame); - time_controller_.AdvanceTime(TimeDelta::ms(1)); + time_controller_.AdvanceTime(TimeDelta::Millis(1)); video_stream_decoder_.OnFrame( FrameBuilder().WithPayloadType(2).WithPictureId(1).Build()); EXPECT_CALL(decoder_factory_.Av1Decoder(), DecodeCall); EXPECT_CALL(callbacks_, OnDecodedFrame); - time_controller_.AdvanceTime(TimeDelta::ms(1)); + time_controller_.AdvanceTime(TimeDelta::Millis(1)); } } // namespace diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc index a27639935a..f42423dd0d 100644 --- a/video/video_stream_encoder.cc +++ b/video/video_stream_encoder.cc @@ -1894,10 +1894,10 @@ void VideoStreamEncoder::CheckForAnimatedContent( } else if ((!last_update_rect_ || frame.update_rect() != *last_update_rect_)) { last_update_rect_ = frame.update_rect(); - animation_start_time_ = Timestamp::us(time_when_posted_in_us); + animation_start_time_ = Timestamp::Micros(time_when_posted_in_us); } else { TimeDelta animation_duration = - Timestamp::us(time_when_posted_in_us) - animation_start_time_; + Timestamp::Micros(time_when_posted_in_us) - animation_start_time_; float area_ratio = static_cast(last_update_rect_->width * last_update_rect_->height) / (frame.width() * frame.height()); diff --git a/video/video_stream_encoder_unittest.cc b/video/video_stream_encoder_unittest.cc index 323168a92e..bde799b8d3 100644 --- a/video/video_stream_encoder_unittest.cc +++ b/video/video_stream_encoder_unittest.cc @@ -438,7 +438,7 @@ class VideoStreamEncoderTest : public ::testing::Test { video_encoder_config.video_stream_factory->CreateEncoderStreams( codec_width_, codec_height_, video_encoder_config); max_framerate_ = streams[0].max_framerate; - fake_clock_.SetTime(Timestamp::us(1234)); + fake_clock_.SetTime(Timestamp::Micros(1234)); ConfigureEncoder(std::move(video_encoder_config)); } @@ -667,28 +667,28 @@ class VideoStreamEncoderTest : public ::testing::Test { void WaitForEncodedFrame(int64_t expected_ntp_time) { sink_.WaitForEncodedFrame(expected_ntp_time); - fake_clock_.AdvanceTime(TimeDelta::seconds(1) / max_framerate_); + fake_clock_.AdvanceTime(TimeDelta::Seconds(1) / max_framerate_); } bool TimedWaitForEncodedFrame(int64_t expected_ntp_time, int64_t timeout_ms) { bool ok = sink_.TimedWaitForEncodedFrame(expected_ntp_time, timeout_ms); - fake_clock_.AdvanceTime(TimeDelta::seconds(1) / max_framerate_); + fake_clock_.AdvanceTime(TimeDelta::Seconds(1) / max_framerate_); return ok; } void WaitForEncodedFrame(uint32_t expected_width, uint32_t expected_height) { sink_.WaitForEncodedFrame(expected_width, expected_height); - fake_clock_.AdvanceTime(TimeDelta::seconds(1) / max_framerate_); + fake_clock_.AdvanceTime(TimeDelta::Seconds(1) / max_framerate_); } void ExpectDroppedFrame() { sink_.ExpectDroppedFrame(); - fake_clock_.AdvanceTime(TimeDelta::seconds(1) / max_framerate_); + fake_clock_.AdvanceTime(TimeDelta::Seconds(1) / max_framerate_); } bool WaitForFrame(int64_t timeout_ms) { bool ok = sink_.WaitForFrame(timeout_ms); - fake_clock_.AdvanceTime(TimeDelta::seconds(1) / max_framerate_); + fake_clock_.AdvanceTime(TimeDelta::Seconds(1) / max_framerate_); return ok; } @@ -3380,7 +3380,7 @@ TEST_F(VideoStreamEncoderTest, CallsBitrateObserver) { EXPECT_EQ(bitrate_allocation.get_sum_bps(), kLowTargetBitrateBps); // TODO(srte): The use of millisecs here looks like an error, but the tests // fails using seconds, this should be investigated. - fake_clock_.AdvanceTime(TimeDelta::ms(1) / kDefaultFps); + fake_clock_.AdvanceTime(TimeDelta::Millis(1) / kDefaultFps); // Not called on second frame. EXPECT_CALL(bitrate_observer, OnBitrateAllocationUpdated(expected_bitrate)) @@ -3388,7 +3388,7 @@ TEST_F(VideoStreamEncoderTest, CallsBitrateObserver) { video_source_.IncomingCapturedFrame( CreateFrame(rtc::TimeMillis(), codec_width_, codec_height_)); WaitForEncodedFrame(rtc::TimeMillis()); - fake_clock_.AdvanceTime(TimeDelta::ms(1) / kDefaultFps); + fake_clock_.AdvanceTime(TimeDelta::Millis(1) / kDefaultFps); // Called after a process interval. EXPECT_CALL(bitrate_observer, OnBitrateAllocationUpdated(expected_bitrate)) @@ -3398,7 +3398,7 @@ TEST_F(VideoStreamEncoderTest, CallsBitrateObserver) { video_source_.IncomingCapturedFrame( CreateFrame(rtc::TimeMillis(), codec_width_, codec_height_)); WaitForEncodedFrame(rtc::TimeMillis()); - fake_clock_.AdvanceTime(TimeDelta::ms(1) / kDefaultFps); + fake_clock_.AdvanceTime(TimeDelta::Millis(1) / kDefaultFps); } // Since rates are unchanged, encoder should not be reconfigured. @@ -3835,7 +3835,7 @@ TEST_F(VideoStreamEncoderTest, RampsUpInQualityWhenBwIsHigh) { EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution); EXPECT_LT(source.sink_wants().max_pixel_count, kWidth * kHeight); - fake_clock_.AdvanceTime(TimeDelta::ms(2000)); + fake_clock_.AdvanceTime(TimeDelta::Millis(2000)); // Insert frame should trigger high BW and release quality limitation. timestamp_ms += kFrameIntervalMs; @@ -4093,7 +4093,7 @@ TEST_F(VideoStreamEncoderTest, DoesntAdaptDownPastMinFramerate) { sink_.WaitForEncodedFrame(timestamp_ms); } timestamp_ms += kFrameIntervalMs; - fake_clock_.AdvanceTime(TimeDelta::ms(kFrameIntervalMs)); + fake_clock_.AdvanceTime(TimeDelta::Millis(kFrameIntervalMs)); } // ...and then try to adapt again. video_stream_encoder_->TriggerCpuOveruse(); @@ -4606,7 +4606,7 @@ TEST_F(VideoStreamEncoderTest, DoesNotUpdateBitrateAllocationWhenSuspended) { // Skip ahead until a new periodic parameter update should have occured. timestamp_ms += kProcessIntervalMs; - fake_clock_.AdvanceTime(TimeDelta::ms(kProcessIntervalMs)); + fake_clock_.AdvanceTime(TimeDelta::Millis(kProcessIntervalMs)); // Bitrate observer should not be called. EXPECT_CALL(bitrate_observer, OnBitrateAllocationUpdated(_)).Times(0);