Mark cricket port type constants as deprecated
...and remove remaining references to them
Bug: webrtc:15846
Change-Id: Ica41c0d3cf7bc8698749a5ddb4b8f90a0c8c1162
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/343784
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41968}
diff --git a/api/candidate.cc b/api/candidate.cc
index 2b8eb3c..9a35201 100644
--- a/api/candidate.cc
+++ b/api/candidate.cc
@@ -37,11 +37,6 @@
namespace cricket {
-ABSL_CONST_INIT const absl::string_view LOCAL_PORT_TYPE = "local";
-ABSL_CONST_INIT const absl::string_view STUN_PORT_TYPE = "stun";
-ABSL_CONST_INIT const absl::string_view PRFLX_PORT_TYPE = "prflx";
-ABSL_CONST_INIT const absl::string_view RELAY_PORT_TYPE = "relay";
-
Candidate::Candidate()
: id_(rtc::CreateRandomString(8)),
component_(ICE_CANDIDATE_COMPONENT_DEFAULT),
diff --git a/api/candidate.h b/api/candidate.h
index 49a1298..5f6f7cd 100644
--- a/api/candidate.h
+++ b/api/candidate.h
@@ -31,12 +31,16 @@
namespace cricket {
-// TODO(tommi): These are temporarily here, moved from `port.h` and will
-// eventually be removed once we use enums instead of strings for these values.
-RTC_EXPORT extern const absl::string_view LOCAL_PORT_TYPE;
-RTC_EXPORT extern const absl::string_view STUN_PORT_TYPE;
-RTC_EXPORT extern const absl::string_view PRFLX_PORT_TYPE;
-RTC_EXPORT extern const absl::string_view RELAY_PORT_TYPE;
+// TODO(tommi): Remove. No usage in WebRTC now, remove once downstream projects
+// don't have reliance.
+[[deprecated("Use IceCandidateType")]] static constexpr char LOCAL_PORT_TYPE[] =
+ "local";
+[[deprecated("Use IceCandidateType")]] static constexpr char STUN_PORT_TYPE[] =
+ "stun";
+[[deprecated("Use IceCandidateType")]] static constexpr char PRFLX_PORT_TYPE[] =
+ "prflx";
+[[deprecated("Use IceCandidateType")]] static constexpr char RELAY_PORT_TYPE[] =
+ "relay";
// TURN servers are limited to 32 in accordance with
// https://w3c.github.io/webrtc-pc/#dom-rtcconfiguration-iceservers
diff --git a/p2p/base/port.cc b/p2p/base/port.cc
index 4393671..4e31cf9 100644
--- a/p2p/base/port.cc
+++ b/p2p/base/port.cc
@@ -89,17 +89,6 @@
return absl::nullopt;
}
-IceCandidateType PortTypeToIceCandidateType(const absl::string_view type) {
- if (type == "host" || type == LOCAL_PORT_TYPE)
- return IceCandidateType::kHost;
- if (type == "srflx" || type == STUN_PORT_TYPE)
- return IceCandidateType::kSrflx;
- if (type == PRFLX_PORT_TYPE)
- return IceCandidateType::kPrflx;
- RTC_DCHECK_EQ(type, RELAY_PORT_TYPE);
- return IceCandidateType::kRelay;
-}
-
// RFC 6544, TCP candidate encoding rules.
const int DISCARD_PORT = 9;
const char TCPTYPE_ACTIVE_STR[] = "active";
diff --git a/p2p/base/port.h b/p2p/base/port.h
index 6705291..fade90a 100644
--- a/p2p/base/port.h
+++ b/p2p/base/port.h
@@ -122,8 +122,6 @@
const char* ProtoToString(ProtocolType proto);
absl::optional<ProtocolType> StringToProto(absl::string_view proto_name);
-webrtc::IceCandidateType PortTypeToIceCandidateType(
- const absl::string_view type);
struct ProtocolAddress {
rtc::SocketAddress address;