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 {
std::string SpecToString(VideoResolution::Spec spec) {
absl::string_view SpecToString(VideoResolution::Spec spec) {
switch (spec) {
case VideoResolution::Spec::kNone:
return "None";
@ -207,24 +207,22 @@ VideoConfig::VideoConfig(const VideoResolution& resolution)
}
VideoConfig::VideoConfig(size_t width, size_t height, int32_t 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 height,
int32_t fps)
: width(width),
height(height),
fps(fps),
stream_label(std::move(stream_label)) {}
: width(width), height(height), fps(fps), stream_label(stream_label) {}
AudioConfig::AudioConfig(std::string stream_label)
: stream_label(std::move(stream_label)) {}
AudioConfig::AudioConfig(absl::string_view 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(
std::string name,
absl::string_view name,
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(
rtc::ArrayView<const VideoConfig> video_configs) {

View file

@ -306,7 +306,7 @@ class VideoDumpOptions {
struct VideoConfig {
explicit VideoConfig(const VideoResolution& resolution);
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 height,
int32_t fps);
@ -381,7 +381,7 @@ struct AudioConfig {
};
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.
// Will be auto generated if omitted.
@ -405,8 +405,8 @@ struct AudioConfig {
};
struct VideoCodecConfig {
explicit VideoCodecConfig(std::string name);
VideoCodecConfig(std::string name,
explicit VideoCodecConfig(absl::string_view name);
VideoCodecConfig(absl::string_view name,
std::map<std::string, std::string> required_params);
// 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/

View file

@ -181,12 +181,12 @@ PeerConfigurer* PeerConfigurer::SetUseNetworkThreadAsWorkerThread() {
return this;
}
PeerConfigurer* PeerConfigurer::SetRtcEventLogPath(std::string path) {
params_->rtc_event_log_path = std::move(path);
PeerConfigurer* PeerConfigurer::SetRtcEventLogPath(absl::string_view path) {
params_->rtc_event_log_path = std::string(path);
return this;
}
PeerConfigurer* PeerConfigurer::SetAecDumpPath(std::string path) {
params_->aec_dump_path = std::move(path);
PeerConfigurer* PeerConfigurer::SetAecDumpPath(absl::string_view path) {
params_->aec_dump_path = std::string(path);
return this;
}
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
// 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
// available for further analysis.
PeerConfigurer* SetAecDumpPath(std::string path);
PeerConfigurer* SetAecDumpPath(absl::string_view path);
PeerConfigurer* SetRTCConfiguration(
PeerConnectionInterface::RTCConfiguration configuration);
PeerConfigurer* SetRTCOfferAnswerOptions(

View file

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