From a30f8829ffbc5091d5ad6935edc6ecb600cd529d Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Mon, 31 Oct 2022 18:47:06 +0100 Subject: [PATCH] Properly mark RtpRtcp deprecated The clang pragma have been added to ensure we can still test the code until usage is gone, and that we can still have the one implementation compiling without itself tripping on the deprecation errors. Users of the code will have deprecation warnings or error as intended. Bug: webrtc:14617 Change-Id: I21dae57c669557d4d218c235c811174a477be080 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/281221 Reviewed-by: Tomas Gunnarsson Commit-Queue: Florent Castelli Cr-Commit-Position: refs/heads/main@{#38514} --- modules/rtp_rtcp/include/rtp_rtcp.h | 3 +-- modules/rtp_rtcp/source/rtp_rtcp_impl.h | 8 ++++++-- modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc | 5 +++++ modules/rtp_rtcp/source/rtp_sender_egress_unittest.cc | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/rtp_rtcp/include/rtp_rtcp.h b/modules/rtp_rtcp/include/rtp_rtcp.h index 1c23753aeb..e56d5ef637 100644 --- a/modules/rtp_rtcp/include/rtp_rtcp.h +++ b/modules/rtp_rtcp/include/rtp_rtcp.h @@ -18,8 +18,7 @@ namespace webrtc { -// DEPRECATED. Do not use. -class RtpRtcp : public RtpRtcpInterface { +class ABSL_DEPRECATED("") RtpRtcp : public RtpRtcpInterface { public: // Instantiates a deprecated version of the RtpRtcp module. static std::unique_ptr ABSL_DEPRECATED("") diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h index 0f4f00453d..cbe30dddf5 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h @@ -43,8 +43,12 @@ class Clock; struct PacedPacketInfo; struct RTPVideoHeader; -// DEPRECATED. -class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +class ABSL_DEPRECATED("") ModuleRtpRtcpImpl + : public RtpRtcp, + public RTCPReceiver::ModuleRtpRtcp { +#pragma clang diagnostic pop public: explicit ModuleRtpRtcpImpl( const RtpRtcpInterface::Configuration& configuration); diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc index 9b9c1d8970..96bef23a3a 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc @@ -44,6 +44,9 @@ const uint8_t kPayloadType = 100; const int kWidth = 320; const int kHeight = 100; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + class RtcpRttStatsTestImpl : public RtcpRttStats { public: RtcpRttStatsTestImpl() : rtt_ms_(0) {} @@ -697,4 +700,6 @@ TEST_F(RtpRtcpImplTest, SenderReportStatsPacketByteCounters) { Field(&SenderReportStats::bytes_sent, Gt(0u))))); } +#pragma clang diagnostic pop + } // namespace webrtc diff --git a/modules/rtp_rtcp/source/rtp_sender_egress_unittest.cc b/modules/rtp_rtcp/source/rtp_sender_egress_unittest.cc index 22224f0e28..30e0c64a30 100644 --- a/modules/rtp_rtcp/source/rtp_sender_egress_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_sender_egress_unittest.cc @@ -154,8 +154,8 @@ class RtpSenderEgressTest : public ::testing::TestWithParam { return std::make_unique(DefaultConfig(), &packet_history_); } - RtpRtcp::Configuration DefaultConfig() { - RtpRtcp::Configuration config; + RtpRtcpInterface::Configuration DefaultConfig() { + RtpRtcpInterface::Configuration config; config.clock = clock_; config.outgoing_transport = &transport_; config.local_media_ssrc = kSsrc;