Mark deprecated features with [[deprecated]] This was the result of asking Gemini "Consider the interfaces in @api. There are comments that indicate that certain methods are deprecated, but the methods don't have [[deprecated]] on them. Make a CL that adds [[deprecated]] to those methods" followed by a few rounds of reverting and working around errors. Bug: None Change-Id: I5d7b1f89fff01277ce96e940aa7340cdfcb728cc Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/407441 Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#45623}
diff --git a/api/audio/audio_processing_statistics.cc b/api/audio/audio_processing_statistics.cc index 90da7e8..b6e92ea 100644 --- a/api/audio/audio_processing_statistics.cc +++ b/api/audio/audio_processing_statistics.cc
@@ -14,8 +14,13 @@ AudioProcessingStats::AudioProcessingStats() = default; +// TODO: https://issues.webrtc.org/42221314 - remove pragma when deprecated +// field `voice_detected` is removed. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" AudioProcessingStats::AudioProcessingStats(const AudioProcessingStats& other) = default; +#pragma clang diagnostic pop AudioProcessingStats::~AudioProcessingStats() = default;
diff --git a/api/audio/audio_processing_statistics.h b/api/audio/audio_processing_statistics.h index d6f8b6e..897af0c 100644 --- a/api/audio/audio_processing_statistics.h +++ b/api/audio/audio_processing_statistics.h
@@ -20,6 +20,8 @@ namespace webrtc { // This version of the stats uses Optionals, it will replace the regular // AudioProcessingStatistics struct. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" struct RTC_EXPORT AudioProcessingStats { AudioProcessingStats(); AudioProcessingStats(const AudioProcessingStats& other); @@ -31,7 +33,7 @@ // It is conservative in flagging audio as speech, with low likelihood of // incorrectly flagging a frame as voice. // Only reported if voice detection is enabled in AudioProcessing::Config. - std::optional<bool> voice_detected; + [[deprecated("bugs.webrtc.org/11226")]] std::optional<bool> voice_detected; // AEC Statistics. // ERL = 10log_10(P_far / P_echo) @@ -62,6 +64,7 @@ // call to `GetStatistics()`. std::optional<int32_t> delay_ms; }; +#pragma clang diagnostic pop } // namespace webrtc
diff --git a/api/call/bitrate_allocation.h b/api/call/bitrate_allocation.h index e055750..20f8b69 100644 --- a/api/call/bitrate_allocation.h +++ b/api/call/bitrate_allocation.h
@@ -28,6 +28,7 @@ // Predicted round trip time. TimeDelta round_trip_time = TimeDelta::PlusInfinity(); // `bwe_period` is deprecated. + // TODO: https://issues.webrtc.org/442860748 - complete removal. TimeDelta bwe_period = TimeDelta::PlusInfinity(); // Congestion window pushback bitrate reduction fraction. Used in // VideoStreamEncoder to reduce the bitrate by the given fraction
diff --git a/api/candidate.cc b/api/candidate.cc index bb12f06..a92f00e 100644 --- a/api/candidate.cc +++ b/api/candidate.cc
@@ -196,6 +196,11 @@ } Candidate Candidate::ToSanitizedCopy(bool use_hostname_address, + bool filter_related_address) const { + return ToSanitizedCopy(use_hostname_address, filter_related_address, false); +} + +Candidate Candidate::ToSanitizedCopy(bool use_hostname_address, bool filter_related_address, bool filter_ufrag) const { Candidate copy(*this);
diff --git a/api/candidate.h b/api/candidate.h index c6f16a5..7e2b138 100644 --- a/api/candidate.h +++ b/api/candidate.h
@@ -236,9 +236,7 @@ // any remote ice parameters have been set. [[deprecated("Use variant with filter_ufrag")]] Candidate ToSanitizedCopy( bool use_hostname_address, - bool filter_related_address) const { - return ToSanitizedCopy(use_hostname_address, filter_related_address, false); - } + bool filter_related_address) const; Candidate ToSanitizedCopy(bool use_hostname_address, bool filter_related_address, bool filter_ufrag) const;
diff --git a/api/data_channel_interface.h b/api/data_channel_interface.h index 4a8299a..e9c0c78 100644 --- a/api/data_channel_interface.h +++ b/api/data_channel_interface.h
@@ -32,10 +32,12 @@ // C++ version of: https://www.w3.org/TR/webrtc/#idl-def-rtcdatachannelinit // TODO(deadbeef): Use std::optional for the "-1 if unset" things. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" struct DataChannelInit { // Deprecated. Reliability is assumed, and channel will be unreliable if // maxRetransmitTime or MaxRetransmits is set. - bool reliable = false; + [[deprecated]] bool reliable = false; // True if ordered delivery is required. bool ordered = true; @@ -69,6 +71,7 @@ // https://w3c.github.io/webrtc-priority/#new-rtcdatachannelinit-member std::optional<PriorityValue> priority; }; +#pragma clang diagnostic pop // At the JavaScript level, data can be passed in as a string or a blob, so // this structure's `binary` flag tells whether the data should be interpreted
diff --git a/api/dtls_transport_interface.h b/api/dtls_transport_interface.h index 79099f4..3b11015 100644 --- a/api/dtls_transport_interface.h +++ b/api/dtls_transport_interface.h
@@ -55,13 +55,14 @@ std::optional<int> srtp_cipher_suite, std::unique_ptr<SSLCertChain> remote_ssl_certificates, std::optional<int> ssl_group_id); - ABSL_DEPRECATED("Use version with role parameter") - DtlsTransportInformation( - DtlsTransportState state, - std::optional<int> tls_version, - std::optional<int> ssl_cipher_suite, - std::optional<int> srtp_cipher_suite, - std::unique_ptr<SSLCertChain> remote_ssl_certificates); + [[deprecated("Use version with role parameter")]] ABSL_DEPRECATED( + "Use version with role parameter") + DtlsTransportInformation( + DtlsTransportState state, + std::optional<int> tls_version, + std::optional<int> ssl_cipher_suite, + std::optional<int> srtp_cipher_suite, + std::unique_ptr<SSLCertChain> remote_ssl_certificates); // Copy and assign DtlsTransportInformation(const DtlsTransportInformation& c);
diff --git a/api/dtmf_sender_interface.h b/api/dtmf_sender_interface.h index 3b18483..ba1948f 100644 --- a/api/dtmf_sender_interface.h +++ b/api/dtmf_sender_interface.h
@@ -32,7 +32,8 @@ // DEPRECATED: Older API without tone buffer. // TODO(bugs.webrtc.org/9725): Remove old API and default implementation // when old callers are gone. - virtual void OnToneChange(const std::string& /* tone */) {} + [[deprecated("Use OnToneChange with tone_buffer")]] virtual void OnToneChange( + const std::string& /* tone */) {} protected: virtual ~DtmfSenderObserverInterface() = default;
diff --git a/api/jsep.h b/api/jsep.h index 7495535..df0ebdc 100644 --- a/api/jsep.h +++ b/api/jsep.h
@@ -89,8 +89,7 @@ std::string ToString() const; // TODO: webrtc:406795492 - Deprecate and remove this method. - // [[deprecated("Use ToString()")]] - bool ToString(std::string* out) const { + [[deprecated("Use ToString()")]] bool ToString(std::string* out) const { if (!out) return false; *out = ToString();
diff --git a/api/peer_connection_interface.h b/api/peer_connection_interface.h index 15942a4..aea35c2 100644 --- a/api/peer_connection_interface.h +++ b/api/peer_connection_interface.h
@@ -1132,8 +1132,8 @@ // to the MID of the m= section that generated the candidate. // TODO(bugs.webrtc.org/8395): Use IceCandidate instead of // Candidate, which would avoid the transport_name oddity. - [[deprecated("Use IceCandidate version")]] - virtual bool RemoveIceCandidates(const std::vector<Candidate>& candidates); + [[deprecated("Use IceCandidate version")]] virtual bool RemoveIceCandidates( + const std::vector<Candidate>& candidates); // SetBitrate limits the bandwidth allocated for all RTP streams sent by // this PeerConnection. Other limitations might affect these limits and
diff --git a/api/rtp_receiver_interface.h b/api/rtp_receiver_interface.h index bf87f46..8e301ee 100644 --- a/api/rtp_receiver_interface.h +++ b/api/rtp_receiver_interface.h
@@ -116,9 +116,8 @@ // Sets a frame transformer between the depacketizer and the decoder to enable // client code to transform received frames according to their own processing // logic. - // TODO: bugs.webrtc.org/15929 - add [[deprecated("Use SetFrameTransformer")]] - // when usage in Chrome is removed - virtual void SetDepacketizerToDecoderFrameTransformer( + [[deprecated("Use SetFrameTransformer")]] virtual void + SetDepacketizerToDecoderFrameTransformer( scoped_refptr<FrameTransformerInterface> frame_transformer) { SetFrameTransformer(std::move(frame_transformer)); }
diff --git a/api/rtp_sender_interface.h b/api/rtp_sender_interface.h index 2a7907d..db04b95 100644 --- a/api/rtp_sender_interface.h +++ b/api/rtp_sender_interface.h
@@ -118,9 +118,8 @@ // user. This can be used to update the state of the object. virtual scoped_refptr<FrameEncryptorInterface> GetFrameEncryptor() const = 0; - // TODO: bugs.webrtc.org/15929 - add [[deprecated("Use SetFrameTransformer")]] - // when usage in Chrome is removed - virtual void SetEncoderToPacketizerFrameTransformer( + [[deprecated("Use SetFrameTransformer")]] virtual void + SetEncoderToPacketizerFrameTransformer( scoped_refptr<FrameTransformerInterface> frame_transformer) { SetFrameTransformer(std::move(frame_transformer)); }
diff --git a/api/uma_metrics.h b/api/uma_metrics.h index d794688..53511ef 100644 --- a/api/uma_metrics.h +++ b/api/uma_metrics.h
@@ -48,7 +48,7 @@ enum IceCandidatePairType { // HostHost is deprecated. It was replaced with the set of types at the bottom // to report private or public host IP address. - kIceCandidatePairHostHost = 0, + kIceCandidatePairHostHost [[deprecated]] = 0, kIceCandidatePairHostSrflx = 1, kIceCandidatePairHostRelay = 2, kIceCandidatePairHostPrflx = 3,
diff --git a/modules/audio_processing/audio_processing_unittest.cc b/modules/audio_processing/audio_processing_unittest.cc index ce668ba..8a36515 100644 --- a/modules/audio_processing/audio_processing_unittest.cc +++ b/modules/audio_processing/audio_processing_unittest.cc
@@ -2875,7 +2875,10 @@ StreamConfig(frame.sample_rate_hz, frame.num_channels()), frame.data.data()), 0); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" EXPECT_FALSE(apm->GetStatistics().voice_detected.has_value()); +#pragma clang diagnostic pop } TEST(ApmStatistics, GetStatisticsReportsNoEchoDetectorStatsWhenDisabled) {
diff --git a/modules/audio_processing/include/audio_frame_proxies.cc b/modules/audio_processing/include/audio_frame_proxies.cc index 97d81e6..8452325 100644 --- a/modules/audio_processing/include/audio_frame_proxies.cc +++ b/modules/audio_processing/include/audio_frame_proxies.cc
@@ -31,11 +31,15 @@ AudioProcessingStats stats = ap->GetStatistics(); + // TODO: https://issues.webrtc.org/42221314 - remove when deleted +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" if (stats.voice_detected) { frame->vad_activity_ = *stats.voice_detected ? AudioFrame::VADActivity::kVadActive : AudioFrame::VADActivity::kVadPassive; } +#pragma clang diagnostic pop return result; }
diff --git a/pc/data_channel_unittest.cc b/pc/data_channel_unittest.cc index 603b7f9..dca2d6e 100644 --- a/pc/data_channel_unittest.cc +++ b/pc/data_channel_unittest.cc
@@ -164,8 +164,11 @@ // Note that the `init_.reliable` field is deprecated, so we directly set // it here to match spec behavior for purposes of checking the `reliable()` // getter. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" init_.reliable = (!init_.maxRetransmits && !init_.maxRetransmitTime); EXPECT_EQ(channel_->reliable(), init_.reliable); +#pragma clang diagnostic pop EXPECT_EQ(channel_->ordered(), init_.ordered); EXPECT_EQ(channel_->negotiated(), init_.negotiated); EXPECT_EQ(channel_->priority(), PriorityValue(Priority::kLow));
diff --git a/pc/dtmf_sender.cc b/pc/dtmf_sender.cc index 703fe9b..7890e58 100644 --- a/pc/dtmf_sender.cc +++ b/pc/dtmf_sender.cc
@@ -191,7 +191,10 @@ // Fire a “OnToneChange” event with an empty string and stop. if (observer_) { observer_->OnToneChange(std::string(), tones_); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" observer_->OnToneChange(std::string()); +#pragma clang diagnostic pop } return; } else { @@ -229,7 +232,10 @@ if (observer_) { observer_->OnToneChange(tones_.substr(first_tone_pos, 1), tones_.substr(first_tone_pos + 1)); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" observer_->OnToneChange(tones_.substr(first_tone_pos, 1)); +#pragma clang diagnostic pop } // Erase the unrecognized characters plus the tone that's just processed.
diff --git a/pc/dtmf_sender_unittest.cc b/pc/dtmf_sender_unittest.cc index deb18fe..9c62cc1 100644 --- a/pc/dtmf_sender_unittest.cc +++ b/pc/dtmf_sender_unittest.cc
@@ -200,8 +200,6 @@ const std::vector<std::string>& tones = observer_->tones(); // The observer will get an empty string at the end. EXPECT_EQ(tones_ref.size() + 1, tones.size()); - EXPECT_EQ(observer_->tones(), - observer_->tones_from_single_argument_callback()); EXPECT_TRUE(tones.back().empty()); EXPECT_TRUE(observer_->tones_remaining().empty()); std::string::const_iterator it_ref = tones_ref.begin();
diff --git a/pc/peer_connection_integrationtest.cc b/pc/peer_connection_integrationtest.cc index 2d5deb8..7a8d086 100644 --- a/pc/peer_connection_integrationtest.cc +++ b/pc/peer_connection_integrationtest.cc
@@ -2136,9 +2136,12 @@ EXPECT_METRIC_EQ(0, num_best_ipv6); } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" EXPECT_METRIC_EQ( 0, metrics::NumEvents("WebRTC.PeerConnection.CandidatePairType_UDP", kIceCandidatePairHostHost)); +#pragma clang diagnostic pop EXPECT_METRIC_EQ( 1, metrics::NumEvents("WebRTC.PeerConnection.CandidatePairType_UDP", kIceCandidatePairHostPublicHostPublic));
diff --git a/pc/sctp_data_channel.cc b/pc/sctp_data_channel.cc index 7cca341..18a8e8a 100644 --- a/pc/sctp_data_channel.cc +++ b/pc/sctp_data_channel.cc
@@ -84,8 +84,11 @@ END_PROXY_MAP(DataChannel) } // namespace +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" InternalDataChannelInit::InternalDataChannelInit(const DataChannelInit& base) : DataChannelInit(base), open_handshake_role(kOpener) { +#pragma clang diagnostic pop // If the channel is externally negotiated, do not send the OPEN message. if (base.negotiated) { open_handshake_role = kNone;
diff --git a/sdk/objc/unittests/RTCIceCandidateTest.mm b/sdk/objc/unittests/RTCIceCandidateTest.mm index c000be5..268d330 100644 --- a/sdk/objc/unittests/RTCIceCandidateTest.mm +++ b/sdk/objc/unittests/RTCIceCandidateTest.mm
@@ -39,8 +39,7 @@ EXPECT_EQ("audio", nativeCandidate->sdp_mid()); EXPECT_EQ(0, nativeCandidate->sdp_mline_index()); - std::string sdpString; - nativeCandidate->ToString(&sdpString); + std::string sdpString = nativeCandidate->ToString(); EXPECT_EQ(sdp.stdString, sdpString); }