Add stream label to audio streams in PC E2E framework

Bug: webrtc:10138
Change-Id: I18cbc219df817df54a8c4123c05ac348e0a30c75
Reviewed-on: https://webrtc-review.googlesource.com/c/124983
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26901}
This commit is contained in:
Artem Titov 2019-02-28 13:13:15 +01:00 committed by Commit Bot
parent 970f2f7c1a
commit 3481db2090
3 changed files with 35 additions and 18 deletions

View File

@ -116,6 +116,7 @@ class PeerConnectionE2EQualityTestFixture {
size_t height;
int32_t fps;
// Have to be unique among all specified configs for all peers in the call.
// Will be auto generated if omitted.
absl::optional<std::string> stream_label;
// Only single from 3 next fields can be specified.
// If specified generator with this name will be used as input.
@ -131,7 +132,7 @@ class PeerConnectionE2EQualityTestFixture {
// video stream has not spatial layers and simulcast streams.
// 2. |target_spatial_index| presented and simulcast encoder is used:
// in such case |target_spatial_index| will specify the index of
// simulcast strem, that should be analyzed. Other streams will be
// simulcast stream, that should be analyzed. Other streams will be
// dropped.
// 3. |target_spatial_index| presented and SVP encoder is used:
// in such case |target_spatial_index| will specify the top interesting
@ -156,6 +157,9 @@ class PeerConnectionE2EQualityTestFixture {
kGenerated,
kFile,
};
// Have to be unique among all specified configs for all peers in the call.
// Will be auto generated if omitted.
absl::optional<std::string> stream_label;
Mode mode;
// Have to be specified only if mode = kFile
absl::optional<std::string> input_file_name;

View File

@ -69,11 +69,9 @@ TEST(PeerConnectionE2EQualityTestSmokeTest, RunWithEmulatedNetwork) {
alice_video_config.generator = VideoGeneratorType::kDefault;
alice_params->video_configs.push_back(alice_video_config);
alice_params->audio_config = AudioConfig{
AudioConfig::Mode::kGenerated,
/*input_file_name=*/absl::nullopt,
/*input_dump_file_name=*/absl::nullopt,
/*output_dump_file_name=*/absl::nullopt, cricket::AudioOptions()};
alice_params->audio_config = AudioConfig();
alice_params->audio_config->mode = AudioConfig::Mode::kGenerated,
alice_params->audio_config->audio_options = cricket::AudioOptions();
auto bob_params = absl::make_unique<Params>();
VideoConfig bob_video_config;
@ -84,11 +82,9 @@ TEST(PeerConnectionE2EQualityTestSmokeTest, RunWithEmulatedNetwork) {
bob_video_config.generator = VideoGeneratorType::kDefault;
bob_params->video_configs.push_back(bob_video_config);
bob_params->audio_config = AudioConfig{
AudioConfig::Mode::kGenerated,
/*input_file_name=*/absl::nullopt,
/*input_dump_file_name=*/absl::nullopt,
/*output_dump_file_name=*/absl::nullopt, cricket::AudioOptions()};
bob_params->audio_config = AudioConfig();
bob_params->audio_config->mode = AudioConfig::Mode::kGenerated,
bob_params->audio_config->audio_options = cricket::AudioOptions();
// Setup emulated network
NetworkEmulationManager network_emulation_manager;

View File

@ -266,24 +266,37 @@ void PeerConnectionE2EQualityTest::Run(
void PeerConnectionE2EQualityTest::SetMissedVideoStreamLabels(
std::vector<Params*> params) {
int counter = 0;
int video_counter = 0;
int audio_counter = 0;
std::set<std::string> video_labels;
std::set<std::string> audio_labels;
for (auto* p : params) {
for (auto& video_config : p->video_configs) {
if (!video_config.stream_label) {
std::string label;
do {
label = "_auto_video_stream_label_" + std::to_string(counter);
++counter;
label = "_auto_video_stream_label_" + std::to_string(video_counter);
++video_counter;
} while (!video_labels.insert(label).second);
video_config.stream_label = label;
}
}
if (p->audio_config) {
if (!p->audio_config->stream_label) {
std::string label;
do {
label = "_auto_audio_stream_label_" + std::to_string(audio_counter);
++audio_counter;
} while (!audio_labels.insert(label).second);
p->audio_config->stream_label = label;
}
}
}
}
void PeerConnectionE2EQualityTest::ValidateParams(std::vector<Params*> params) {
std::set<std::string> video_labels;
std::set<std::string> audio_labels;
int media_streams_count = 0;
for (Params* p : params) {
@ -313,6 +326,10 @@ void PeerConnectionE2EQualityTest::ValidateParams(std::vector<Params*> params) {
<< VideoConfigSourcePresenceToString(video_config);
}
if (p->audio_config) {
bool inserted =
audio_labels.insert(p->audio_config->stream_label.value()).second;
RTC_CHECK(inserted) << "Duplicate audio_config.stream_label="
<< p->audio_config->stream_label.value();
// Check that if mode input file name specified only if mode is kFile.
if (p->audio_config.value().mode == AudioConfig::Mode::kGenerated) {
RTC_CHECK(!p->audio_config.value().input_file_name);
@ -466,12 +483,12 @@ void PeerConnectionE2EQualityTest::MaybeAddAudio(TestPeer* peer) {
if (!peer->params()->audio_config) {
return;
}
const AudioConfig& audio_config = peer->params()->audio_config.value();
rtc::scoped_refptr<webrtc::AudioSourceInterface> source =
peer->pc_factory()->CreateAudioSource(
peer->params()->audio_config->audio_options);
peer->pc_factory()->CreateAudioSource(audio_config.audio_options);
rtc::scoped_refptr<AudioTrackInterface> track =
peer->pc_factory()->CreateAudioTrack("audio", source);
peer->AddTrack(track, {"audio"});
peer->pc_factory()->CreateAudioTrack(*audio_config.stream_label, source);
peer->AddTrack(track, {*audio_config.stream_label});
}
void PeerConnectionE2EQualityTest::SetupCall() {