From e137c4592e6c2b4e1d8b7d1c0b7f200ec4dd62d9 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Tue, 10 Jan 2023 13:06:02 +0100 Subject: [PATCH] stats: deprecate timestamp_us constructor and method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in favor of the Timestamp constructor and method. The constructor is most likely not used outside libWebRTC, the call to .timestamp_us() can be replaced with .timestamp().us() BUG=webrtc:14813 Change-Id: Id166b4f85b2425ecec1c7ebb81406f82ff9d95c9 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/290727 Reviewed-by: Henrik Boström Reviewed-by: Danil Chapovalov Commit-Queue: Philipp Hancke Cr-Commit-Position: refs/heads/main@{#39066} --- api/stats/rtc_stats.h | 2 ++ api/stats/rtcstats_objects.h | 21 +++++++++++++++++++++ stats/test/rtc_test_stats.h | 1 + 3 files changed, 24 insertions(+) diff --git a/api/stats/rtc_stats.h b/api/stats/rtc_stats.h index a08d4bd8f9..72775243c7 100644 --- a/api/stats/rtc_stats.h +++ b/api/stats/rtc_stats.h @@ -58,6 +58,7 @@ class RTC_EXPORT RTCStats { public: RTCStats(const std::string& id, Timestamp timestamp) : id_(id), timestamp_(timestamp) {} + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCStats(std::string id, int64_t timestamp_us) : RTCStats(std::move(id), Timestamp::Micros(timestamp_us)) {} @@ -67,6 +68,7 @@ class RTC_EXPORT RTCStats { const std::string& id() const { return id_; } // Time relative to the UNIX epoch (Jan 1, 1970, UTC), in microseconds. + ABSL_DEPRECATED("Use .timestamp().us() instead") int64_t timestamp_us() const { return timestamp_.us(); } Timestamp timestamp() const { return timestamp_; } diff --git a/api/stats/rtcstats_objects.h b/api/stats/rtcstats_objects.h index 1647989e41..47bca78b74 100644 --- a/api/stats/rtcstats_objects.h +++ b/api/stats/rtcstats_objects.h @@ -121,6 +121,7 @@ class RTC_EXPORT RTCCertificateStats final : public RTCStats { WEBRTC_RTCSTATS_DECL(); RTCCertificateStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCCertificateStats(std::string id, int64_t timestamp_us); RTCCertificateStats(const RTCCertificateStats& other); ~RTCCertificateStats() override; @@ -151,6 +152,7 @@ class RTC_EXPORT RTCCodecStats final : public RTCStats { WEBRTC_RTCSTATS_DECL(); RTCCodecStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCCodecStats(std::string id, int64_t timestamp_us); RTCCodecStats(const RTCCodecStats& other); ~RTCCodecStats() override; @@ -169,6 +171,7 @@ class RTC_EXPORT RTCDataChannelStats final : public RTCStats { WEBRTC_RTCSTATS_DECL(); RTCDataChannelStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCDataChannelStats(std::string id, int64_t timestamp_us); RTCDataChannelStats(const RTCDataChannelStats& other); ~RTCDataChannelStats() override; @@ -190,6 +193,7 @@ class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats { WEBRTC_RTCSTATS_DECL(); RTCIceCandidatePairStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCIceCandidatePairStats(std::string id, int64_t timestamp_us); RTCIceCandidatePairStats(const RTCIceCandidatePairStats& other); ~RTCIceCandidatePairStats() override; @@ -259,6 +263,7 @@ class RTC_EXPORT RTCIceCandidateStats : public RTCStats { protected: RTCIceCandidateStats(std::string id, Timestamp timestamp, bool is_remote); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCIceCandidateStats(std::string id, int64_t timestamp_us, bool is_remote); }; @@ -271,6 +276,7 @@ class RTC_EXPORT RTCLocalIceCandidateStats final : public RTCIceCandidateStats { public: static const char kType[]; RTCLocalIceCandidateStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCLocalIceCandidateStats(std::string id, int64_t timestamp_us); std::unique_ptr copy() const override; const char* type() const override; @@ -281,6 +287,7 @@ class RTC_EXPORT RTCRemoteIceCandidateStats final public: static const char kType[]; RTCRemoteIceCandidateStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCRemoteIceCandidateStats(std::string id, int64_t timestamp_us); std::unique_ptr copy() const override; const char* type() const override; @@ -292,6 +299,7 @@ class RTC_EXPORT DEPRECATED_RTCMediaStreamStats final : public RTCStats { WEBRTC_RTCSTATS_DECL(); DEPRECATED_RTCMediaStreamStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") DEPRECATED_RTCMediaStreamStats(std::string id, int64_t timestamp_us); DEPRECATED_RTCMediaStreamStats(const DEPRECATED_RTCMediaStreamStats& other); ~DEPRECATED_RTCMediaStreamStats() override; @@ -310,6 +318,7 @@ class RTC_EXPORT DEPRECATED_RTCMediaStreamTrackStats final : public RTCStats { DEPRECATED_RTCMediaStreamTrackStats(std::string id, Timestamp timestamp, const char* kind); + ABSL_DEPRECATED("Use constructor with Timestamp instead") DEPRECATED_RTCMediaStreamTrackStats(std::string id, int64_t timestamp_us, const char* kind); @@ -357,6 +366,7 @@ class RTC_EXPORT RTCPeerConnectionStats final : public RTCStats { WEBRTC_RTCSTATS_DECL(); RTCPeerConnectionStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCPeerConnectionStats(std::string id, int64_t timestamp_us); RTCPeerConnectionStats(const RTCPeerConnectionStats& other); ~RTCPeerConnectionStats() override; @@ -385,6 +395,7 @@ class RTC_EXPORT RTCRTPStreamStats : public RTCStats { protected: RTCRTPStreamStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCRTPStreamStats(std::string id, int64_t timestamp_us); }; @@ -401,6 +412,7 @@ class RTC_EXPORT RTCReceivedRtpStreamStats : public RTCRTPStreamStats { protected: RTCReceivedRtpStreamStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCReceivedRtpStreamStats(std::string id, int64_t timestamp_us); }; @@ -417,6 +429,7 @@ class RTC_EXPORT RTCSentRtpStreamStats : public RTCRTPStreamStats { protected: RTCSentRtpStreamStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCSentRtpStreamStats(std::string id, int64_t timestamp_us); }; @@ -427,6 +440,7 @@ class RTC_EXPORT RTCInboundRTPStreamStats final WEBRTC_RTCSTATS_DECL(); RTCInboundRTPStreamStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCInboundRTPStreamStats(std::string id, int64_t timestamp_us); RTCInboundRTPStreamStats(const RTCInboundRTPStreamStats& other); ~RTCInboundRTPStreamStats() override; @@ -515,6 +529,7 @@ class RTC_EXPORT RTCOutboundRTPStreamStats final : public RTCRTPStreamStats { WEBRTC_RTCSTATS_DECL(); RTCOutboundRTPStreamStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCOutboundRTPStreamStats(std::string id, int64_t timestamp_us); RTCOutboundRTPStreamStats(const RTCOutboundRTPStreamStats& other); ~RTCOutboundRTPStreamStats() override; @@ -569,6 +584,7 @@ class RTC_EXPORT RTCRemoteInboundRtpStreamStats final WEBRTC_RTCSTATS_DECL(); RTCRemoteInboundRtpStreamStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCRemoteInboundRtpStreamStats(std::string id, int64_t timestamp_us); RTCRemoteInboundRtpStreamStats(const RTCRemoteInboundRtpStreamStats& other); ~RTCRemoteInboundRtpStreamStats() override; @@ -587,6 +603,7 @@ class RTC_EXPORT RTCRemoteOutboundRtpStreamStats final WEBRTC_RTCSTATS_DECL(); RTCRemoteOutboundRtpStreamStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCRemoteOutboundRtpStreamStats(std::string id, int64_t timestamp_us); RTCRemoteOutboundRtpStreamStats(const RTCRemoteOutboundRtpStreamStats& other); ~RTCRemoteOutboundRtpStreamStats() override; @@ -612,6 +629,7 @@ class RTC_EXPORT RTCMediaSourceStats : public RTCStats { protected: RTCMediaSourceStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCMediaSourceStats(std::string id, int64_t timestamp_us); }; @@ -621,6 +639,7 @@ class RTC_EXPORT RTCAudioSourceStats final : public RTCMediaSourceStats { WEBRTC_RTCSTATS_DECL(); RTCAudioSourceStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCAudioSourceStats(std::string id, int64_t timestamp_us); RTCAudioSourceStats(const RTCAudioSourceStats& other); ~RTCAudioSourceStats() override; @@ -638,6 +657,7 @@ class RTC_EXPORT RTCVideoSourceStats final : public RTCMediaSourceStats { WEBRTC_RTCSTATS_DECL(); RTCVideoSourceStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCVideoSourceStats(std::string id, int64_t timestamp_us); RTCVideoSourceStats(const RTCVideoSourceStats& other); ~RTCVideoSourceStats() override; @@ -654,6 +674,7 @@ class RTC_EXPORT RTCTransportStats final : public RTCStats { WEBRTC_RTCSTATS_DECL(); RTCTransportStats(std::string id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCTransportStats(std::string id, int64_t timestamp_us); RTCTransportStats(const RTCTransportStats& other); ~RTCTransportStats() override; diff --git a/stats/test/rtc_test_stats.h b/stats/test/rtc_test_stats.h index dea432e83e..082002db5f 100644 --- a/stats/test/rtc_test_stats.h +++ b/stats/test/rtc_test_stats.h @@ -26,6 +26,7 @@ class RTC_EXPORT RTCTestStats : public RTCStats { WEBRTC_RTCSTATS_DECL(); RTCTestStats(const std::string& id, Timestamp timestamp); + ABSL_DEPRECATED("Use constructor with Timestamp instead") RTCTestStats(const std::string& id, int64_t timestamp_us); RTCTestStats(const RTCTestStats& other); ~RTCTestStats() override;