Remove pc level test framework redundant code.
After the migration to passing frame video source implementation directly, part of the peer connection framework code became redundant. Removing screen_share_config and capturing_device_index from the VideoConfig is to be done in later reviews.
Bug: webrtc:11534
Change-Id: I7a8ea85d26d00fb5bfe7ec0d2facef9c44a0f749
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174541
Commit-Queue: Andrey Logvin <landrey@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31178}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index ad041d3..1316e76 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -483,6 +483,7 @@
":create_frame_generator",
":frame_generator_api",
":peer_connection_quality_test_fixture_api",
+ "../rtc_base:checks",
"../test:fileutils",
"//third_party/abseil-cpp/absl/types:optional",
]
diff --git a/api/test/create_peer_connection_quality_test_frame_generator.cc b/api/test/create_peer_connection_quality_test_frame_generator.cc
index b00751f..d9f0937 100644
--- a/api/test/create_peer_connection_quality_test_frame_generator.cc
+++ b/api/test/create_peer_connection_quality_test_frame_generator.cc
@@ -15,6 +15,7 @@
#include "api/test/create_frame_generator.h"
#include "api/test/peerconnection_quality_test_fixture.h"
+#include "rtc_base/checks.h"
#include "test/testsupport/file_utils.h"
namespace webrtc {
@@ -92,9 +93,9 @@
screen_share_config.slide_change_interval.seconds() * video_config.fps);
}
- // |pause_duration| is nonnegative. It is validated in ValidateParams(...).
TimeDelta pause_duration = screen_share_config.slide_change_interval -
screen_share_config.scrolling_params->duration;
+ RTC_DCHECK(pause_duration >= TimeDelta::Zero());
return test::CreateScrollingInputFromYuvFilesFrameGenerator(
Clock::GetRealTimeClock(), slides,
screen_share_config.scrolling_params->source_width,
diff --git a/api/test/create_peer_connection_quality_test_frame_generator.h b/api/test/create_peer_connection_quality_test_frame_generator.h
index 6b56e8e..ff87331 100644
--- a/api/test/create_peer_connection_quality_test_frame_generator.h
+++ b/api/test/create_peer_connection_quality_test_frame_generator.h
@@ -20,16 +20,6 @@
namespace webrtc {
namespace webrtc_pc_e2e {
-// Validates that ScreeanShare frame generator can be created based on the
-// screen_share_config.
-// This function is temporarily added to the public interface and will be
-// removed from here after refactoring is done.
-// TODO(landrey) remove from the header file
-void ValidateScreenShareConfig(
- const PeerConnectionE2EQualityTestFixture::VideoConfig& video_config,
- const PeerConnectionE2EQualityTestFixture::ScreenShareConfig&
- screen_share_config);
-
// Creates a frame generator that produces frames with small squares that move
// randomly towards the lower right corner. |type| has the default value
// FrameGeneratorInterface::OutputType::I420. video_config specifies frame
diff --git a/api/test/peerconnection_quality_test_fixture.h b/api/test/peerconnection_quality_test_fixture.h
index 64671bf..5c27202 100644
--- a/api/test/peerconnection_quality_test_fixture.h
+++ b/api/test/peerconnection_quality_test_fixture.h
@@ -170,23 +170,10 @@
// 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;
- // You can specify one of |generator|, |input_file_name|,
- // |screen_share_config| and |capturing_device_index|.
- // If none of them are specified and config is added to the PeerConfigurer
- // without specifying any video source, then |generator| will be set to
- // VideoGeneratorType::kDefault.
- // If video source implementation is specified,
- // then it will be used as video source regardless of other
- // options. Please consider this way unless you are using
- // |capturing_device_index| option, since the possibility of using other
- // three is about to be removed.
- // 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.
- absl::optional<std::string> input_file_name;
- // If specified screen share video stream will be created as input.
+ // If set, determines whether VideoTrackInterface::ContentHint::kText is set
+ // for the current video track.
+ // TODO(landrey) replace by use_text_content_hint boolean field.
absl::optional<ScreenShareConfig> screen_share_config;
// If specified this capturing device will be used to get input video. The
// |capturing_device_index| is the index of required capturing device in OS
diff --git a/test/pc/e2e/BUILD.gn b/test/pc/e2e/BUILD.gn
index ac4fe32..3be1812 100644
--- a/test/pc/e2e/BUILD.gn
+++ b/test/pc/e2e/BUILD.gn
@@ -274,7 +274,6 @@
"../..:platform_video_capturer",
"../..:video_test_common",
"../../../api:create_frame_generator",
- "../../../api:create_peer_connection_quality_test_frame_generator",
"../../../api:frame_generator_api",
"../../../api:peer_connection_quality_test_fixture_api",
"../../../api/video:video_frame",
diff --git a/test/pc/e2e/media/media_helper.cc b/test/pc/e2e/media/media_helper.cc
index 3848c15..0dd7ab5 100644
--- a/test/pc/e2e/media/media_helper.cc
+++ b/test/pc/e2e/media/media_helper.cc
@@ -13,7 +13,6 @@
#include <utility>
#include "api/test/create_frame_generator.h"
-#include "api/test/create_peer_connection_quality_test_frame_generator.h"
#include "test/frame_generator_capturer.h"
#include "test/platform_video_capturer.h"
#include "test/testsupport/file_utils.h"
@@ -109,37 +108,10 @@
return capturer;
}
- std::unique_ptr<test::FrameGeneratorInterface> frame_generator = nullptr;
- if (generator) {
- frame_generator = std::move(generator);
- } else if (video_config.generator) {
- absl::optional<test::FrameGeneratorInterface::OutputType>
- frame_generator_type = absl::nullopt;
- if (video_config.generator == VideoGeneratorType::kDefault) {
- frame_generator_type = test::FrameGeneratorInterface::OutputType::kI420;
- } else if (video_config.generator == VideoGeneratorType::kI420A) {
- frame_generator_type = test::FrameGeneratorInterface::OutputType::kI420A;
- } else if (video_config.generator == VideoGeneratorType::kI010) {
- frame_generator_type = test::FrameGeneratorInterface::OutputType::kI010;
- }
- frame_generator =
- test::CreateSquareFrameGenerator(static_cast<int>(video_config.width),
- static_cast<int>(video_config.height),
- frame_generator_type, absl::nullopt);
- } else if (video_config.input_file_name) {
- frame_generator = test::CreateFromYuvFileFrameGenerator(
- std::vector<std::string>(/*count=*/1,
- video_config.input_file_name.value()),
- video_config.width, video_config.height, /*frame_repeat_count=*/1);
- } else if (video_config.screen_share_config) {
- frame_generator = CreateScreenShareFrameGenerator(
- video_config, *video_config.screen_share_config);
- }
- RTC_CHECK(frame_generator) << "Unsupported video_config input source";
+ RTC_CHECK(generator) << "No input source.";
auto capturer = std::make_unique<test::FrameGeneratorCapturer>(
- clock_, std::move(frame_generator), video_config.fps,
- *task_queue_factory_);
+ clock_, std::move(generator), video_config.fps, *task_queue_factory_);
capturer->SetFramePreprocessor(std::move(frame_preprocessor));
capturer->Init();
return capturer;
diff --git a/test/pc/e2e/peer_configurer.cc b/test/pc/e2e/peer_configurer.cc
index 81f0fdb..1102f68 100644
--- a/test/pc/e2e/peer_configurer.cc
+++ b/test/pc/e2e/peer_configurer.cc
@@ -16,7 +16,6 @@
namespace webrtc {
namespace webrtc_pc_e2e {
-namespace {
using AudioConfig = PeerConnectionE2EQualityTestFixture::AudioConfig;
using VideoConfig = PeerConnectionE2EQualityTestFixture::VideoConfig;
@@ -25,25 +24,6 @@
PeerConnectionE2EQualityTestFixture::VideoGeneratorType;
using VideoCodecConfig = PeerConnectionE2EQualityTestFixture::VideoCodecConfig;
-std::string VideoConfigSourcePresenceToString(
- const VideoConfig& video_config,
- bool has_user_provided_generator) {
- char buf[1024];
- rtc::SimpleStringBuilder builder(buf);
- builder << "video_config.generator=" << video_config.generator.has_value()
- << "; video_config.input_file_name="
- << video_config.input_file_name.has_value()
- << "; video_config.screen_share_config="
- << video_config.screen_share_config.has_value()
- << "; video_config.capturing_device_index="
- << video_config.capturing_device_index.has_value()
- << "; has_user_provided_generator=" << has_user_provided_generator
- << ";";
- return builder.str();
-}
-
-} // namespace
-
void SetDefaultValuesForMissingParams(
RunParams* run_params,
std::vector<std::unique_ptr<PeerConfigurerImpl>>* peers) {
@@ -54,15 +34,7 @@
for (size_t i = 0; i < peers->size(); ++i) {
auto* peer = peers->at(i).get();
auto* p = peer->params();
- for (size_t j = 0; j < p->video_configs.size(); ++j) {
- VideoConfig& video_config = p->video_configs[j];
- std::unique_ptr<test::FrameGeneratorInterface>& video_generator =
- (*peer->video_generators())[j];
- if (!video_config.generator && !video_config.input_file_name &&
- !video_config.screen_share_config &&
- !video_config.capturing_device_index && !video_generator) {
- video_config.generator = VideoGeneratorType::kDefault;
- }
+ for (VideoConfig& video_config : p->video_configs) {
if (!video_config.stream_label) {
std::string label;
do {
@@ -107,40 +79,14 @@
}
media_streams_count += p->video_configs.size();
- // Validate that each video config has exactly one of |generator|,
- // |input_file_name| or |screen_share_config| set. Also validate that all
- // video stream labels are unique.
- for (size_t j = 0; j < p->video_configs.size(); ++j) {
- VideoConfig& video_config = p->video_configs[j];
+ // Validate that all video stream labels are unique.
+ for (const VideoConfig& video_config : p->video_configs) {
RTC_CHECK(video_config.stream_label);
bool inserted =
video_labels.insert(video_config.stream_label.value()).second;
RTC_CHECK(inserted) << "Duplicate video_config.stream_label="
<< video_config.stream_label.value();
- bool user_provided_generator = false;
- int input_sources_count = 0;
- if ((*peers[i]->video_generators())[j]) {
- user_provided_generator = true;
- ++input_sources_count;
- }
- if (video_config.generator)
- ++input_sources_count;
- if (video_config.input_file_name)
- ++input_sources_count;
- if (video_config.screen_share_config)
- ++input_sources_count;
- if (video_config.capturing_device_index)
- ++input_sources_count;
- RTC_CHECK(input_sources_count == 1 ||
- (input_sources_count == 2 && user_provided_generator))
- << VideoConfigSourcePresenceToString(video_config,
- user_provided_generator);
-
- if (video_config.screen_share_config) {
- ValidateScreenShareConfig(video_config,
- *video_config.screen_share_config);
- }
if (video_config.simulcast_config) {
has_simulcast = true;
RTC_CHECK(!video_config.max_encode_bitrate_bps)