[PCLF] Make PeerParamsPreprocessor C++ style compliant
Bug: b/213863770 Change-Id: I9749ac9fdc5561c1bc145b199a2e39633615938b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260111 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36662}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
10f42a3b62
commit
82caafd607
@ -61,13 +61,13 @@ std::string DefaultNamesProvider::GenerateNameInternal() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PeerParamsPreprocessor::PeerParamsPreprocessor()
|
PeerParamsPreprocessor::PeerParamsPreprocessor()
|
||||||
: peer_names_provider("peer_", kDefaultNames) {}
|
: peer_names_provider_("peer_", kDefaultNames) {}
|
||||||
|
|
||||||
void PeerParamsPreprocessor::SetDefaultValuesForMissingParams(
|
void PeerParamsPreprocessor::SetDefaultValuesForMissingParams(
|
||||||
PeerConfigurerImpl& peer) {
|
PeerConfigurerImpl& peer) {
|
||||||
Params* params = peer.params();
|
Params* params = peer.params();
|
||||||
ConfigurableParams* configurable_params = peer.configurable_params();
|
ConfigurableParams* configurable_params = peer.configurable_params();
|
||||||
peer_names_provider.MaybeSetName(params->name);
|
peer_names_provider_.MaybeSetName(params->name);
|
||||||
DefaultNamesProvider video_stream_names_provider(*params->name +
|
DefaultNamesProvider video_stream_names_provider(*params->name +
|
||||||
"_auto_video_stream_label_");
|
"_auto_video_stream_label_");
|
||||||
for (size_t i = 0; i < configurable_params->video_configs.size(); ++i) {
|
for (size_t i = 0; i < configurable_params->video_configs.size(); ++i) {
|
||||||
@ -99,22 +99,17 @@ void PeerParamsPreprocessor::ValidateParams(const PeerConfigurerImpl& peer) {
|
|||||||
|
|
||||||
{
|
{
|
||||||
RTC_CHECK(p.name);
|
RTC_CHECK(p.name);
|
||||||
bool inserted = peer_names.insert(p.name.value()).second;
|
bool inserted = peer_names_.insert(p.name.value()).second;
|
||||||
RTC_CHECK(inserted) << "Duplicate name=" << p.name.value();
|
RTC_CHECK(inserted) << "Duplicate name=" << p.name.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.audio_config) {
|
|
||||||
media_streams_count++;
|
|
||||||
}
|
|
||||||
media_streams_count += peer.configurable_params().video_configs.size();
|
|
||||||
|
|
||||||
// Validate that all video stream labels are unique and sync groups are
|
// Validate that all video stream labels are unique and sync groups are
|
||||||
// valid.
|
// valid.
|
||||||
for (const VideoConfig& video_config :
|
for (const VideoConfig& video_config :
|
||||||
peer.configurable_params().video_configs) {
|
peer.configurable_params().video_configs) {
|
||||||
RTC_CHECK(video_config.stream_label);
|
RTC_CHECK(video_config.stream_label);
|
||||||
bool inserted =
|
bool inserted =
|
||||||
video_labels.insert(video_config.stream_label.value()).second;
|
video_labels_.insert(video_config.stream_label.value()).second;
|
||||||
RTC_CHECK(inserted) << "Duplicate video_config.stream_label="
|
RTC_CHECK(inserted) << "Duplicate video_config.stream_label="
|
||||||
<< video_config.stream_label.value();
|
<< video_config.stream_label.value();
|
||||||
|
|
||||||
@ -131,7 +126,7 @@ void PeerParamsPreprocessor::ValidateParams(const PeerConfigurerImpl& peer) {
|
|||||||
// more than two streams is supported.
|
// more than two streams is supported.
|
||||||
if (video_config.sync_group.has_value()) {
|
if (video_config.sync_group.has_value()) {
|
||||||
bool sync_group_inserted =
|
bool sync_group_inserted =
|
||||||
video_sync_groups.insert(video_config.sync_group.value()).second;
|
video_sync_groups_.insert(video_config.sync_group.value()).second;
|
||||||
RTC_CHECK(sync_group_inserted)
|
RTC_CHECK(sync_group_inserted)
|
||||||
<< "Sync group shouldn't consist of more than two streams (one "
|
<< "Sync group shouldn't consist of more than two streams (one "
|
||||||
"video and one audio). Duplicate video_config.sync_group="
|
"video and one audio). Duplicate video_config.sync_group="
|
||||||
@ -159,14 +154,14 @@ void PeerParamsPreprocessor::ValidateParams(const PeerConfigurerImpl& peer) {
|
|||||||
}
|
}
|
||||||
if (p.audio_config) {
|
if (p.audio_config) {
|
||||||
bool inserted =
|
bool inserted =
|
||||||
audio_labels.insert(p.audio_config->stream_label.value()).second;
|
audio_labels_.insert(p.audio_config->stream_label.value()).second;
|
||||||
RTC_CHECK(inserted) << "Duplicate audio_config.stream_label="
|
RTC_CHECK(inserted) << "Duplicate audio_config.stream_label="
|
||||||
<< p.audio_config->stream_label.value();
|
<< p.audio_config->stream_label.value();
|
||||||
// TODO(bugs.webrtc.org/4762): remove this check after synchronization of
|
// TODO(bugs.webrtc.org/4762): remove this check after synchronization of
|
||||||
// more than two streams is supported.
|
// more than two streams is supported.
|
||||||
if (p.audio_config->sync_group.has_value()) {
|
if (p.audio_config->sync_group.has_value()) {
|
||||||
bool sync_group_inserted =
|
bool sync_group_inserted =
|
||||||
audio_sync_groups.insert(p.audio_config->sync_group.value()).second;
|
audio_sync_groups_.insert(p.audio_config->sync_group.value()).second;
|
||||||
RTC_CHECK(sync_group_inserted)
|
RTC_CHECK(sync_group_inserted)
|
||||||
<< "Sync group shouldn't consist of more than two streams (one "
|
<< "Sync group shouldn't consist of more than two streams (one "
|
||||||
"video and one audio). Duplicate audio_config.sync_group="
|
"video and one audio). Duplicate audio_config.sync_group="
|
||||||
|
@ -325,14 +325,13 @@ class PeerParamsPreprocessor {
|
|||||||
void ValidateParams(const PeerConfigurerImpl& peer);
|
void ValidateParams(const PeerConfigurerImpl& peer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DefaultNamesProvider peer_names_provider;
|
DefaultNamesProvider peer_names_provider_;
|
||||||
|
|
||||||
std::set<std::string> peer_names;
|
std::set<std::string> peer_names_;
|
||||||
std::set<std::string> video_labels;
|
std::set<std::string> video_labels_;
|
||||||
std::set<std::string> audio_labels;
|
std::set<std::string> audio_labels_;
|
||||||
std::set<std::string> video_sync_groups;
|
std::set<std::string> video_sync_groups_;
|
||||||
std::set<std::string> audio_sync_groups;
|
std::set<std::string> audio_sync_groups_;
|
||||||
int media_streams_count = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc_pc_e2e
|
} // namespace webrtc_pc_e2e
|
||||||
|
Reference in New Issue
Block a user