diff --git a/api/stats/rtc_stats_report.h b/api/stats/rtc_stats_report.h index 1cc6293fec..8678eb35bf 100644 --- a/api/stats/rtc_stats_report.h +++ b/api/stats/rtc_stats_report.h @@ -63,16 +63,20 @@ class RTC_EXPORT RTCStatsReport final // TODO(bugs.webrtc.org/13756): deprecate this in favor of Timestamp. // TODO(hbos): Remove "= 0" once downstream has been updated to call with a // parameter. + ABSL_DEPRECATED("Call Create with Timestamp instead") static rtc::scoped_refptr Create(int64_t timestamp_us = 0); static rtc::scoped_refptr Create(Timestamp timestamp); // TODO(bugs.webrtc.org/13756): deprecate this in favor of Timestamp. + ABSL_DEPRECATED("Use constructor with Timestamp instead") explicit RTCStatsReport(int64_t timestamp_us); explicit RTCStatsReport(Timestamp timestamp); RTCStatsReport(const RTCStatsReport& other) = delete; rtc::scoped_refptr Copy() const; + // TODO(bugs.webrtc.org/13756): deprecate this in favor of Timestamp. + ABSL_DEPRECATED("Call timestamp() instead") int64_t timestamp_us() const { return timestamp_.us_or(-1); } Timestamp timestamp() const { return timestamp_; } void AddStats(std::unique_ptr stats); diff --git a/pc/peer_connection_integrationtest.cc b/pc/peer_connection_integrationtest.cc index 5d1820d6c9..1d1bec3e93 100644 --- a/pc/peer_connection_integrationtest.cc +++ b/pc/peer_connection_integrationtest.cc @@ -2434,7 +2434,7 @@ TEST_P(PeerConnectionIntegrationTestWithFakeClock, // The fake clock ensures that no time has passed so the cache must have been // explicitly invalidated. - EXPECT_EQ(first_report->timestamp_us(), second_report->timestamp_us()); + EXPECT_EQ(first_report->timestamp(), second_report->timestamp()); } TEST_P(PeerConnectionIntegrationTestWithFakeClock, @@ -2478,7 +2478,7 @@ TEST_P(PeerConnectionIntegrationTestWithFakeClock, // The fake clock ensures that no time has passed so the cache must have been // explicitly invalidated. - EXPECT_EQ(first_report->timestamp_us(), second_report->timestamp_us()); + EXPECT_EQ(first_report->timestamp(), second_report->timestamp()); } #endif // !defined(THREAD_SANITIZER) diff --git a/stats/rtc_stats_report.cc b/stats/rtc_stats_report.cc index f6fbd8c44d..e6885dc020 100644 --- a/stats/rtc_stats_report.cc +++ b/stats/rtc_stats_report.cc @@ -56,7 +56,8 @@ bool RTCStatsReport::ConstIterator::operator!=( rtc::scoped_refptr RTCStatsReport::Create( int64_t timestamp_us) { - return rtc::scoped_refptr(new RTCStatsReport(timestamp_us)); + return rtc::scoped_refptr( + new RTCStatsReport(Timestamp::Micros(timestamp_us))); } rtc::scoped_refptr RTCStatsReport::Create(Timestamp timestamp) { diff --git a/stats/rtc_stats_report_unittest.cc b/stats/rtc_stats_report_unittest.cc index b69da62f08..ded0c27609 100644 --- a/stats/rtc_stats_report_unittest.cc +++ b/stats/rtc_stats_report_unittest.cc @@ -55,7 +55,6 @@ WEBRTC_RTCSTATS_IMPL(RTCTestStats3, RTCStats, "test-stats-3", &string) TEST(RTCStatsReport, AddAndGetStats) { rtc::scoped_refptr report = RTCStatsReport::Create(Timestamp::Micros(1337)); - EXPECT_EQ(report->timestamp_us(), 1337u); EXPECT_EQ(report->timestamp().us_or(-1), 1337u); EXPECT_EQ(report->size(), static_cast(0)); report->AddStats( @@ -140,7 +139,6 @@ TEST(RTCStatsReport, Take) { TEST(RTCStatsReport, TakeMembersFrom) { rtc::scoped_refptr a = RTCStatsReport::Create(Timestamp::Micros(1337)); - EXPECT_EQ(a->timestamp().us(), 1337u); EXPECT_EQ(a->timestamp().us_or(-1), 1337u); a->AddStats( std::unique_ptr(new RTCTestStats1("B", Timestamp::Micros(1)))); @@ -150,7 +148,6 @@ TEST(RTCStatsReport, TakeMembersFrom) { std::unique_ptr(new RTCTestStats1("E", Timestamp::Micros(4)))); rtc::scoped_refptr b = RTCStatsReport::Create(Timestamp::Micros(1338)); - EXPECT_EQ(b->timestamp_us(), 1338u); EXPECT_EQ(b->timestamp().us_or(-1), 1338u); b->AddStats( std::unique_ptr(new RTCTestStats1("A", Timestamp::Micros(0))));