Change type of candidate type names from char[] to string_view

Bug: none
Change-Id: I57fcfd486bf4e2fb15288614b0e81f00b10e120a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/337443
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41721}
This commit is contained in:
Tommi 2024-02-12 14:52:13 +01:00 committed by WebRTC LUCI CQ
parent e3fb8122aa
commit 521b8632b6
3 changed files with 10 additions and 9 deletions

View File

@ -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)),

View File

@ -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

View File

@ -212,7 +212,7 @@ std::unique_ptr<cricket::Candidate> 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) {