Relax string parameters in pclf api to absl::string_view

Bug: webrtc:13579
Change-Id: I53c133bcbba6a074f3be6b996a3991a71190b1fc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/295865
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39459}
This commit is contained in:
Danil Chapovalov 2023-03-02 15:57:47 +01:00 committed by WebRTC LUCI CQ
parent 298975aa89
commit a76487ffd2
5 changed files with 21 additions and 23 deletions

View file

@ -27,7 +27,7 @@ namespace webrtc {
namespace webrtc_pc_e2e { namespace webrtc_pc_e2e {
namespace { namespace {
std::string SpecToString(VideoResolution::Spec spec) { absl::string_view SpecToString(VideoResolution::Spec spec) {
switch (spec) { switch (spec) {
case VideoResolution::Spec::kNone: case VideoResolution::Spec::kNone:
return "None"; return "None";
@ -207,24 +207,22 @@ VideoConfig::VideoConfig(const VideoResolution& resolution)
} }
VideoConfig::VideoConfig(size_t width, size_t height, int32_t fps) VideoConfig::VideoConfig(size_t width, size_t height, int32_t fps)
: width(width), height(height), fps(fps) {} : width(width), height(height), fps(fps) {}
VideoConfig::VideoConfig(std::string stream_label, VideoConfig::VideoConfig(absl::string_view stream_label,
size_t width, size_t width,
size_t height, size_t height,
int32_t fps) int32_t fps)
: width(width), : width(width), height(height), fps(fps), stream_label(stream_label) {}
height(height),
fps(fps),
stream_label(std::move(stream_label)) {}
AudioConfig::AudioConfig(std::string stream_label) AudioConfig::AudioConfig(absl::string_view stream_label)
: stream_label(std::move(stream_label)) {} : stream_label(stream_label) {}
VideoCodecConfig::VideoCodecConfig(absl::string_view name)
: name(name), required_params() {}
VideoCodecConfig::VideoCodecConfig(std::string name)
: name(std::move(name)), required_params() {}
VideoCodecConfig::VideoCodecConfig( VideoCodecConfig::VideoCodecConfig(
std::string name, absl::string_view name,
std::map<std::string, std::string> required_params) std::map<std::string, std::string> required_params)
: name(std::move(name)), required_params(std::move(required_params)) {} : name(name), required_params(std::move(required_params)) {}
absl::optional<VideoResolution> VideoSubscription::GetMaxResolution( absl::optional<VideoResolution> VideoSubscription::GetMaxResolution(
rtc::ArrayView<const VideoConfig> video_configs) { rtc::ArrayView<const VideoConfig> video_configs) {

View file

@ -306,7 +306,7 @@ class VideoDumpOptions {
struct VideoConfig { struct VideoConfig {
explicit VideoConfig(const VideoResolution& resolution); explicit VideoConfig(const VideoResolution& resolution);
VideoConfig(size_t width, size_t height, int32_t fps); VideoConfig(size_t width, size_t height, int32_t fps);
VideoConfig(std::string stream_label, VideoConfig(absl::string_view stream_label,
size_t width, size_t width,
size_t height, size_t height,
int32_t fps); int32_t fps);
@ -381,7 +381,7 @@ struct AudioConfig {
}; };
AudioConfig() = default; AudioConfig() = default;
explicit AudioConfig(std::string stream_label); explicit AudioConfig(absl::string_view stream_label);
// Have to be unique among all specified configs for all peers in the call. // Have to be unique among all specified configs for all peers in the call.
// Will be auto generated if omitted. // Will be auto generated if omitted.
@ -405,8 +405,8 @@ struct AudioConfig {
}; };
struct VideoCodecConfig { struct VideoCodecConfig {
explicit VideoCodecConfig(std::string name); explicit VideoCodecConfig(absl::string_view name);
VideoCodecConfig(std::string name, VideoCodecConfig(absl::string_view name,
std::map<std::string, std::string> required_params); std::map<std::string, std::string> required_params);
// Next two fields are used to specify concrete video codec, that should be // Next two fields are used to specify concrete video codec, that should be
// used in the test. Video code will be negotiated in SDP during offer/ // used in the test. Video code will be negotiated in SDP during offer/

View file

@ -181,12 +181,12 @@ PeerConfigurer* PeerConfigurer::SetUseNetworkThreadAsWorkerThread() {
return this; return this;
} }
PeerConfigurer* PeerConfigurer::SetRtcEventLogPath(std::string path) { PeerConfigurer* PeerConfigurer::SetRtcEventLogPath(absl::string_view path) {
params_->rtc_event_log_path = std::move(path); params_->rtc_event_log_path = std::string(path);
return this; return this;
} }
PeerConfigurer* PeerConfigurer::SetAecDumpPath(std::string path) { PeerConfigurer* PeerConfigurer::SetAecDumpPath(absl::string_view path) {
params_->aec_dump_path = std::move(path); params_->aec_dump_path = std::string(path);
return this; return this;
} }
PeerConfigurer* PeerConfigurer::SetRTCConfiguration( PeerConfigurer* PeerConfigurer::SetRTCConfiguration(

View file

@ -152,10 +152,10 @@ class PeerConfigurer {
// If is set, an RTCEventLog will be saved in that location and it will be // If is set, an RTCEventLog will be saved in that location and it will be
// available for further analysis. // available for further analysis.
PeerConfigurer* SetRtcEventLogPath(std::string path); PeerConfigurer* SetRtcEventLogPath(absl::string_view path);
// If is set, an AEC dump will be saved in that location and it will be // If is set, an AEC dump will be saved in that location and it will be
// available for further analysis. // available for further analysis.
PeerConfigurer* SetAecDumpPath(std::string path); PeerConfigurer* SetAecDumpPath(absl::string_view path);
PeerConfigurer* SetRTCConfiguration( PeerConfigurer* SetRTCConfiguration(
PeerConnectionInterface::RTCConfiguration configuration); PeerConnectionInterface::RTCConfiguration configuration);
PeerConfigurer* SetRTCOfferAnswerOptions( PeerConfigurer* SetRTCOfferAnswerOptions(

View file

@ -128,7 +128,7 @@ class SvcTest : public testing::TestWithParam<
{{kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}}); {{kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}});
} }
return VideoCodecConfig(std::string(codec)); return VideoCodecConfig(codec);
} }
const SvcTestParameters& SvcTestParameters() const { const SvcTestParameters& SvcTestParameters() const {