mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-19 08:37:54 +01:00
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}
This commit is contained in:
parent
d6b10943c7
commit
1e83d34fc1
7 changed files with 11 additions and 115 deletions
|
@ -483,6 +483,7 @@ rtc_library("create_peer_connection_quality_test_frame_generator") {
|
||||||
":create_frame_generator",
|
":create_frame_generator",
|
||||||
":frame_generator_api",
|
":frame_generator_api",
|
||||||
":peer_connection_quality_test_fixture_api",
|
":peer_connection_quality_test_fixture_api",
|
||||||
|
"../rtc_base:checks",
|
||||||
"../test:fileutils",
|
"../test:fileutils",
|
||||||
"//third_party/abseil-cpp/absl/types:optional",
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include "api/test/create_frame_generator.h"
|
#include "api/test/create_frame_generator.h"
|
||||||
#include "api/test/peerconnection_quality_test_fixture.h"
|
#include "api/test/peerconnection_quality_test_fixture.h"
|
||||||
|
#include "rtc_base/checks.h"
|
||||||
#include "test/testsupport/file_utils.h"
|
#include "test/testsupport/file_utils.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
@ -92,9 +93,9 @@ std::unique_ptr<test::FrameGeneratorInterface> CreateScreenShareFrameGenerator(
|
||||||
screen_share_config.slide_change_interval.seconds() * video_config.fps);
|
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 -
|
TimeDelta pause_duration = screen_share_config.slide_change_interval -
|
||||||
screen_share_config.scrolling_params->duration;
|
screen_share_config.scrolling_params->duration;
|
||||||
|
RTC_DCHECK(pause_duration >= TimeDelta::Zero());
|
||||||
return test::CreateScrollingInputFromYuvFilesFrameGenerator(
|
return test::CreateScrollingInputFromYuvFilesFrameGenerator(
|
||||||
Clock::GetRealTimeClock(), slides,
|
Clock::GetRealTimeClock(), slides,
|
||||||
screen_share_config.scrolling_params->source_width,
|
screen_share_config.scrolling_params->source_width,
|
||||||
|
|
|
@ -20,16 +20,6 @@
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace webrtc_pc_e2e {
|
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
|
// Creates a frame generator that produces frames with small squares that move
|
||||||
// randomly towards the lower right corner. |type| has the default value
|
// randomly towards the lower right corner. |type| has the default value
|
||||||
// FrameGeneratorInterface::OutputType::I420. video_config specifies frame
|
// FrameGeneratorInterface::OutputType::I420. video_config specifies frame
|
||||||
|
|
|
@ -170,23 +170,10 @@ class PeerConnectionE2EQualityTestFixture {
|
||||||
// Have to be unique among all specified configs for all peers in the call.
|
// Have to be unique among all specified configs for all peers in the call.
|
||||||
// Will be auto generated if omitted.
|
// Will be auto generated if omitted.
|
||||||
absl::optional<std::string> stream_label;
|
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.
|
// If set, determines whether VideoTrackInterface::ContentHint::kText is set
|
||||||
absl::optional<VideoGeneratorType> generator;
|
// for the current video track.
|
||||||
// If specified this file will be used as input. Input video will be played
|
// TODO(landrey) replace by use_text_content_hint boolean field.
|
||||||
// in a circle.
|
|
||||||
absl::optional<std::string> input_file_name;
|
|
||||||
// If specified screen share video stream will be created as input.
|
|
||||||
absl::optional<ScreenShareConfig> screen_share_config;
|
absl::optional<ScreenShareConfig> screen_share_config;
|
||||||
// If specified this capturing device will be used to get input video. The
|
// 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
|
// |capturing_device_index| is the index of required capturing device in OS
|
||||||
|
|
|
@ -274,7 +274,6 @@ if (rtc_include_tests) {
|
||||||
"../..:platform_video_capturer",
|
"../..:platform_video_capturer",
|
||||||
"../..:video_test_common",
|
"../..:video_test_common",
|
||||||
"../../../api:create_frame_generator",
|
"../../../api:create_frame_generator",
|
||||||
"../../../api:create_peer_connection_quality_test_frame_generator",
|
|
||||||
"../../../api:frame_generator_api",
|
"../../../api:frame_generator_api",
|
||||||
"../../../api:peer_connection_quality_test_fixture_api",
|
"../../../api:peer_connection_quality_test_fixture_api",
|
||||||
"../../../api/video:video_frame",
|
"../../../api/video:video_frame",
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "api/test/create_frame_generator.h"
|
#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/frame_generator_capturer.h"
|
||||||
#include "test/platform_video_capturer.h"
|
#include "test/platform_video_capturer.h"
|
||||||
#include "test/testsupport/file_utils.h"
|
#include "test/testsupport/file_utils.h"
|
||||||
|
@ -109,37 +108,10 @@ std::unique_ptr<test::TestVideoCapturer> MediaHelper::CreateVideoCapturer(
|
||||||
return capturer;
|
return capturer;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<test::FrameGeneratorInterface> frame_generator = nullptr;
|
RTC_CHECK(generator) << "No input source.";
|
||||||
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";
|
|
||||||
|
|
||||||
auto capturer = std::make_unique<test::FrameGeneratorCapturer>(
|
auto capturer = std::make_unique<test::FrameGeneratorCapturer>(
|
||||||
clock_, std::move(frame_generator), video_config.fps,
|
clock_, std::move(generator), video_config.fps, *task_queue_factory_);
|
||||||
*task_queue_factory_);
|
|
||||||
capturer->SetFramePreprocessor(std::move(frame_preprocessor));
|
capturer->SetFramePreprocessor(std::move(frame_preprocessor));
|
||||||
capturer->Init();
|
capturer->Init();
|
||||||
return capturer;
|
return capturer;
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace webrtc_pc_e2e {
|
namespace webrtc_pc_e2e {
|
||||||
namespace {
|
|
||||||
|
|
||||||
using AudioConfig = PeerConnectionE2EQualityTestFixture::AudioConfig;
|
using AudioConfig = PeerConnectionE2EQualityTestFixture::AudioConfig;
|
||||||
using VideoConfig = PeerConnectionE2EQualityTestFixture::VideoConfig;
|
using VideoConfig = PeerConnectionE2EQualityTestFixture::VideoConfig;
|
||||||
|
@ -25,25 +24,6 @@ using VideoGeneratorType =
|
||||||
PeerConnectionE2EQualityTestFixture::VideoGeneratorType;
|
PeerConnectionE2EQualityTestFixture::VideoGeneratorType;
|
||||||
using VideoCodecConfig = PeerConnectionE2EQualityTestFixture::VideoCodecConfig;
|
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(
|
void SetDefaultValuesForMissingParams(
|
||||||
RunParams* run_params,
|
RunParams* run_params,
|
||||||
std::vector<std::unique_ptr<PeerConfigurerImpl>>* peers) {
|
std::vector<std::unique_ptr<PeerConfigurerImpl>>* peers) {
|
||||||
|
@ -54,15 +34,7 @@ void SetDefaultValuesForMissingParams(
|
||||||
for (size_t i = 0; i < peers->size(); ++i) {
|
for (size_t i = 0; i < peers->size(); ++i) {
|
||||||
auto* peer = peers->at(i).get();
|
auto* peer = peers->at(i).get();
|
||||||
auto* p = peer->params();
|
auto* p = peer->params();
|
||||||
for (size_t j = 0; j < p->video_configs.size(); ++j) {
|
for (VideoConfig& video_config : p->video_configs) {
|
||||||
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;
|
|
||||||
}
|
|
||||||
if (!video_config.stream_label) {
|
if (!video_config.stream_label) {
|
||||||
std::string label;
|
std::string label;
|
||||||
do {
|
do {
|
||||||
|
@ -107,40 +79,14 @@ void ValidateParams(
|
||||||
}
|
}
|
||||||
media_streams_count += p->video_configs.size();
|
media_streams_count += p->video_configs.size();
|
||||||
|
|
||||||
// Validate that each video config has exactly one of |generator|,
|
// Validate that all video stream labels are unique.
|
||||||
// |input_file_name| or |screen_share_config| set. Also validate that all
|
for (const VideoConfig& video_config : p->video_configs) {
|
||||||
// video stream labels are unique.
|
|
||||||
for (size_t j = 0; j < p->video_configs.size(); ++j) {
|
|
||||||
VideoConfig& video_config = p->video_configs[j];
|
|
||||||
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();
|
||||||
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) {
|
if (video_config.simulcast_config) {
|
||||||
has_simulcast = true;
|
has_simulcast = true;
|
||||||
RTC_CHECK(!video_config.max_encode_bitrate_bps)
|
RTC_CHECK(!video_config.max_encode_bitrate_bps)
|
||||||
|
|
Loading…
Reference in a new issue