diff --git a/api/candidate.cc b/api/candidate.cc index 865f8e5787..4311556233 100644 --- a/api/candidate.cc +++ b/api/candidate.cc @@ -10,6 +10,7 @@ #include "api/candidate.h" +#include "absl/base/attributes.h" #include "rtc_base/helpers.h" #include "rtc_base/ip_address.h" #include "rtc_base/logging.h" @@ -17,10 +18,10 @@ namespace cricket { -const char LOCAL_PORT_TYPE[] = "local"; -const char STUN_PORT_TYPE[] = "stun"; -const char PRFLX_PORT_TYPE[] = "prflx"; -const char RELAY_PORT_TYPE[] = "relay"; +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)), diff --git a/api/candidate.h b/api/candidate.h index 3fefd1114b..12b1512e72 100644 --- a/api/candidate.h +++ b/api/candidate.h @@ -32,10 +32,10 @@ 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 char LOCAL_PORT_TYPE[]; -RTC_EXPORT extern const char STUN_PORT_TYPE[]; -RTC_EXPORT extern const char PRFLX_PORT_TYPE[]; -RTC_EXPORT extern const char RELAY_PORT_TYPE[]; +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; // TURN servers are limited to 32 in accordance with // https://w3c.github.io/webrtc-pc/#dom-rtcconfiguration-iceservers diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc index 03512bbcde..98cbd2d7e3 100644 --- a/pc/rtc_stats_collector_unittest.cc +++ b/pc/rtc_stats_collector_unittest.cc @@ -212,7 +212,7 @@ std::unique_ptr CreateFakeCandidate( int port, const std::string& protocol, const rtc::AdapterType adapter_type, - const std::string& candidate_type, + const absl::string_view candidate_type, uint32_t priority, const rtc::AdapterType underlying_type_for_vpn = rtc::ADAPTER_TYPE_UNKNOWN) {