Use default values for video and audio streams generation in PC E2E framework
Bug: webrtc:10138 Change-Id: I91591690f4f2202c32f211a492e96f1aa7844473 Reviewed-on: https://webrtc-review.googlesource.com/c/124986 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26908}
This commit is contained in:
parent
fb14c5d8b9
commit
9a7e721f9d
@ -121,8 +121,10 @@ class PeerConnectionE2EQualityTestFixture {
|
||||
// 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.
|
||||
// Only 1 from |generator|, |input_file_name| and |screen_share_config| can
|
||||
// be specified. If none of them are specified, then |generator| will be set
|
||||
// to VideoGeneratorType::kDefault.
|
||||
// If specified generator of this type will be used to produce input video.
|
||||
absl::optional<VideoGeneratorType> generator;
|
||||
// If specified this file will be used as input. Input video will be played
|
||||
// in a circle.
|
||||
@ -163,7 +165,7 @@ class PeerConnectionE2EQualityTestFixture {
|
||||
// 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;
|
||||
Mode mode = kGenerated;
|
||||
// Have to be specified only if mode = kFile
|
||||
absl::optional<std::string> input_file_name;
|
||||
// If specified the input stream will be also copied to specified file.
|
||||
|
||||
@ -53,8 +53,6 @@ void PrintFrameCounters(const std::string& name,
|
||||
TEST(PeerConnectionE2EQualityTestSmokeTest, RunWithEmulatedNetwork) {
|
||||
using Params = PeerConnectionE2EQualityTestFixture::Params;
|
||||
using RunParams = PeerConnectionE2EQualityTestFixture::RunParams;
|
||||
using VideoGeneratorType =
|
||||
PeerConnectionE2EQualityTestFixture::VideoGeneratorType;
|
||||
using VideoConfig = PeerConnectionE2EQualityTestFixture::VideoConfig;
|
||||
using AudioConfig = PeerConnectionE2EQualityTestFixture::AudioConfig;
|
||||
using InjectableComponents =
|
||||
@ -63,22 +61,16 @@ TEST(PeerConnectionE2EQualityTestSmokeTest, RunWithEmulatedNetwork) {
|
||||
auto alice_params = absl::make_unique<Params>();
|
||||
VideoConfig alice_video_config(1280, 720, 30);
|
||||
alice_video_config.stream_label = "alice-video";
|
||||
alice_video_config.generator = VideoGeneratorType::kDefault;
|
||||
|
||||
alice_params->video_configs.push_back(alice_video_config);
|
||||
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(1280, 720, 30);
|
||||
bob_video_config.stream_label = "bob-video";
|
||||
bob_video_config.generator = VideoGeneratorType::kDefault;
|
||||
|
||||
bob_params->video_configs.push_back(bob_video_config);
|
||||
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;
|
||||
|
||||
@ -133,7 +133,7 @@ void PeerConnectionE2EQualityTest::Run(
|
||||
RTC_CHECK(bob_components);
|
||||
RTC_CHECK(bob_params);
|
||||
|
||||
SetMissedVideoStreamLabels({alice_params.get(), bob_params.get()});
|
||||
SetDefaultValuesForMissingParams({alice_params.get(), bob_params.get()});
|
||||
ValidateParams({alice_params.get(), bob_params.get()});
|
||||
|
||||
// Print test summary
|
||||
@ -264,7 +264,7 @@ void PeerConnectionE2EQualityTest::Run(
|
||||
RTC_CHECK(video_writers_.empty());
|
||||
}
|
||||
|
||||
void PeerConnectionE2EQualityTest::SetMissedVideoStreamLabels(
|
||||
void PeerConnectionE2EQualityTest::SetDefaultValuesForMissingParams(
|
||||
std::vector<Params*> params) {
|
||||
int video_counter = 0;
|
||||
int audio_counter = 0;
|
||||
@ -272,6 +272,10 @@ void PeerConnectionE2EQualityTest::SetMissedVideoStreamLabels(
|
||||
std::set<std::string> audio_labels;
|
||||
for (auto* p : params) {
|
||||
for (auto& video_config : p->video_configs) {
|
||||
if (!video_config.generator && !video_config.input_file_name &&
|
||||
!video_config.screen_share_config) {
|
||||
video_config.generator = VideoGeneratorType::kDefault;
|
||||
}
|
||||
if (!video_config.stream_label) {
|
||||
std::string label;
|
||||
do {
|
||||
|
||||
@ -55,9 +55,11 @@ class PeerConnectionE2EQualityTest
|
||||
RunParams run_params) override;
|
||||
|
||||
private:
|
||||
// Sets video stream labels that are not specified in VideoConfigs to unique
|
||||
// generated values.
|
||||
void SetMissedVideoStreamLabels(std::vector<Params*> params);
|
||||
// Set missing params to default values if it is required:
|
||||
// * Generate video stream labels if some of them missed
|
||||
// * Generate audio stream labels if some of them missed
|
||||
// * Set video source generation mode if it is not specified
|
||||
void SetDefaultValuesForMissingParams(std::vector<Params*> params);
|
||||
// Validate peer's parameters, also ensure uniqueness of all video stream
|
||||
// labels.
|
||||
void ValidateParams(std::vector<Params*> params);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user