Cleanup setting VideoQualityTestFixtureInterface::Param struct

put default values next to the (named) members.
Remove constructor
declared as VideoQualityTestFixtureInterface::Param::Param,
but defined as VideoQualityTest::Param::Param

avoid braced initialisation for structures with lot's of fields that change over time

Bug: None
Change-Id: I647e3ace47ae981c515d6939274cb2744dd1b866
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178811
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31674}
This commit is contained in:
Danil Chapovalov
2020-07-07 14:16:47 +02:00
committed by Commit Bot
parent 0973a55f82
commit 059f4f74df
5 changed files with 146 additions and 191 deletions

View File

@ -22,6 +22,7 @@
#include "api/test/simulated_network.h" #include "api/test/simulated_network.h"
#include "api/transport/bitrate_settings.h" #include "api/transport/bitrate_settings.h"
#include "api/transport/network_control.h" #include "api/transport/network_control.h"
#include "api/video_codecs/sdp_video_format.h"
#include "api/video_codecs/video_decoder_factory.h" #include "api/video_codecs/video_decoder_factory.h"
#include "api/video_codecs/video_encoder_config.h" #include "api/video_codecs/video_encoder_config.h"
#include "api/video_codecs/video_encoder_factory.h" #include "api/video_codecs/video_encoder_factory.h"
@ -31,60 +32,56 @@ namespace webrtc {
class VideoQualityTestFixtureInterface { class VideoQualityTestFixtureInterface {
public: public:
// Parameters are grouped into smaller structs to make it easier to set // Parameters are grouped into smaller structs to make it easier to set
// the desired elements and skip unused, using aggregate initialization. // the desired elements and skip unused.
// Unfortunately, C++11 (as opposed to C11) doesn't support unnamed structs,
// which makes the implementation of VideoQualityTest a bit uglier.
struct Params { struct Params {
Params();
~Params();
struct CallConfig { struct CallConfig {
bool send_side_bwe; bool send_side_bwe = false;
bool generic_descriptor; bool generic_descriptor = false;
BitrateConstraints call_bitrate_config; BitrateConstraints call_bitrate_config;
int num_thumbnails; int num_thumbnails = 0;
// Indicates if secondary_(video|ss|screenshare) structures are used. // Indicates if secondary_(video|ss|screenshare) structures are used.
bool dual_video; bool dual_video = false;
} call; } call;
struct Video { struct Video {
bool enabled; bool enabled = false;
size_t width; size_t width = 640;
size_t height; size_t height = 480;
int32_t fps; int32_t fps = 30;
int min_bitrate_bps; int min_bitrate_bps = 50;
int target_bitrate_bps; int target_bitrate_bps = 800;
int max_bitrate_bps; int max_bitrate_bps = 800;
bool suspend_below_min_bitrate; bool suspend_below_min_bitrate = false;
std::string codec; std::string codec = "VP8";
int num_temporal_layers; int num_temporal_layers = 1;
int selected_tl; int selected_tl = -1;
int min_transmit_bps; int min_transmit_bps = 0;
bool ulpfec; bool ulpfec = false;
bool flexfec; bool flexfec = false;
bool automatic_scaling; bool automatic_scaling = false;
std::string clip_path; // "Generator" to generate frames instead. std::string clip_path; // "Generator" to generate frames instead.
size_t capture_device_index; size_t capture_device_index = 0;
SdpVideoFormat::Parameters sdp_params; SdpVideoFormat::Parameters sdp_params;
double encoder_overshoot_factor; double encoder_overshoot_factor = 0.0;
} video[2]; } video[2];
struct Audio { struct Audio {
bool enabled; bool enabled = false;
bool sync_video; bool sync_video = false;
bool dtx; bool dtx = false;
bool use_real_adm; bool use_real_adm = false;
absl::optional<std::string> ana_config; absl::optional<std::string> ana_config;
} audio; } audio;
struct Screenshare { struct Screenshare {
bool enabled; bool enabled = false;
bool generate_slides; bool generate_slides = false;
int32_t slide_change_interval; int32_t slide_change_interval = 10;
int32_t scroll_duration; int32_t scroll_duration = 0;
std::vector<std::string> slides; std::vector<std::string> slides;
} screenshare[2]; } screenshare[2];
struct Analyzer { struct Analyzer {
std::string test_label; std::string test_label;
double avg_psnr_threshold; // (*) double avg_psnr_threshold = 0.0; // (*)
double avg_ssim_threshold; // (*) double avg_ssim_threshold = 0.0; // (*)
int test_durations_secs; int test_durations_secs = 0;
std::string graph_data_output_filename; std::string graph_data_output_filename;
std::string graph_title; std::string graph_title;
} analyzer; } analyzer;
@ -95,14 +92,14 @@ class VideoQualityTestFixtureInterface {
absl::optional<BuiltInNetworkBehaviorConfig> config; absl::optional<BuiltInNetworkBehaviorConfig> config;
struct SS { // Spatial scalability. struct SS { // Spatial scalability.
std::vector<VideoStream> streams; // If empty, one stream is assumed. std::vector<VideoStream> streams; // If empty, one stream is assumed.
size_t selected_stream; size_t selected_stream = 0;
int num_spatial_layers; int num_spatial_layers = 0;
int selected_sl; int selected_sl = -1;
InterLayerPredMode inter_layer_pred; InterLayerPredMode inter_layer_pred = InterLayerPredMode::kOn;
// If empty, bitrates are generated in VP9Impl automatically. // If empty, bitrates are generated in VP9Impl automatically.
std::vector<SpatialLayer> spatial_layers; std::vector<SpatialLayer> spatial_layers;
// If set, default parameters will be used instead of |streams|. // If set, default parameters will be used instead of |streams|.
bool infer_streams; bool infer_streams = false;
} ss[2]; } ss[2];
struct Logging { struct Logging {
std::string rtc_event_log_name; std::string rtc_event_log_name;

View File

@ -325,32 +325,29 @@ void Loopback() {
call_bitrate_config.max_bitrate_bps = -1; // Don't cap bandwidth estimate. call_bitrate_config.max_bitrate_bps = -1; // Don't cap bandwidth estimate.
VideoQualityTest::Params params; VideoQualityTest::Params params;
params.call = {absl::GetFlag(FLAGS_send_side_bwe), params.call.send_side_bwe = absl::GetFlag(FLAGS_send_side_bwe);
absl::GetFlag(FLAGS_generic_descriptor), call_bitrate_config}; params.call.generic_descriptor = absl::GetFlag(FLAGS_generic_descriptor);
params.video[0] = {true, params.call.call_bitrate_config = call_bitrate_config;
Width(), params.video[0].enabled = true;
Height(), params.video[0].width = Width();
Fps(), params.video[0].height = Height();
MinBitrateKbps() * 1000, params.video[0].fps = Fps();
TargetBitrateKbps() * 1000, params.video[0].min_bitrate_bps = MinBitrateKbps() * 1000;
MaxBitrateKbps() * 1000, params.video[0].target_bitrate_bps = TargetBitrateKbps() * 1000;
false, params.video[0].max_bitrate_bps = MaxBitrateKbps() * 1000;
Codec(), params.video[0].codec = Codec();
NumTemporalLayers(), params.video[0].num_temporal_layers = NumTemporalLayers();
SelectedTL(), params.video[0].selected_tl = SelectedTL();
MinTransmitBitrateKbps() * 1000, params.video[0].min_transmit_bps = MinTransmitBitrateKbps() * 1000;
false, // ULPFEC disabled. params.screenshare[0].enabled = true;
false, // FlexFEC disabled. params.screenshare[0].generate_slides = GenerateSlides();
false, // Automatic scaling disabled. params.screenshare[0].slide_change_interval = SlideChangeInterval();
"", params.screenshare[0].scroll_duration = ScrollDuration();
0, // capture_device_index. params.screenshare[0].slides = Slides();
SdpVideoFormat::Parameters()};
params.screenshare[0] = {true, GenerateSlides(), SlideChangeInterval(),
ScrollDuration(), Slides()};
params.analyzer = {"screenshare", 0.0, 0.0, DurationSecs(),
OutputFilename(), GraphTitle()};
params.config = pipe_config; params.config = pipe_config;
params.logging = {RtcEventLogName(), RtpDumpName(), EncodedFramePath()}; params.logging.rtc_event_log_name = RtcEventLogName();
params.logging.rtp_dump_name = RtpDumpName();
params.logging.encoded_frame_base_path = EncodedFramePath();
if (NumStreams() > 1 && Stream0().empty() && Stream1().empty()) { if (NumStreams() > 1 && Stream0().empty() && Stream1().empty()) {
params.ss[0].infer_streams = true; params.ss[0].infer_streams = true;

View File

@ -605,56 +605,62 @@ void Loopback() {
call_bitrate_config.max_bitrate_bps = call_bitrate_config.max_bitrate_bps =
(ScreenshareMaxBitrateKbps() + VideoMaxBitrateKbps()) * 1000; (ScreenshareMaxBitrateKbps() + VideoMaxBitrateKbps()) * 1000;
VideoQualityTest::Params params, camera_params, screenshare_params; VideoQualityTest::Params params;
params.call = {absl::GetFlag(FLAGS_send_side_bwe), params.call.send_side_bwe = absl::GetFlag(FLAGS_send_side_bwe);
absl::GetFlag(FLAGS_generic_descriptor), call_bitrate_config, params.call.generic_descriptor = absl::GetFlag(FLAGS_generic_descriptor);
0}; params.call.call_bitrate_config = call_bitrate_config;
params.call.dual_video = true; params.call.dual_video = true;
params.video[screenshare_idx] = {true, params.video[screenshare_idx].enabled = true;
ScreenshareWidth(), params.video[screenshare_idx].width = ScreenshareWidth();
ScreenshareHeight(), params.video[screenshare_idx].height = ScreenshareHeight();
ScreenshareFps(), params.video[screenshare_idx].fps = ScreenshareFps();
ScreenshareMinBitrateKbps() * 1000, params.video[screenshare_idx].min_bitrate_bps =
ScreenshareTargetBitrateKbps() * 1000, ScreenshareMinBitrateKbps() * 1000;
ScreenshareMaxBitrateKbps() * 1000, params.video[screenshare_idx].target_bitrate_bps =
false, ScreenshareTargetBitrateKbps() * 1000;
Codec(), params.video[screenshare_idx].max_bitrate_bps =
ScreenshareNumTemporalLayers(), ScreenshareMaxBitrateKbps() * 1000;
ScreenshareSelectedTL(), params.video[screenshare_idx].codec = Codec();
ScreenshareMinTransmitBitrateKbps() * 1000, params.video[screenshare_idx].num_temporal_layers =
false, // ULPFEC disabled. ScreenshareNumTemporalLayers();
false, // FlexFEC disabled. params.video[screenshare_idx].selected_tl = ScreenshareSelectedTL();
false, // Automatic scaling disabled params.video[screenshare_idx].min_transmit_bps =
""}; ScreenshareMinTransmitBitrateKbps() * 1000;
params.video[camera_idx] = {absl::GetFlag(FLAGS_video), params.video[camera_idx].enabled = absl::GetFlag(FLAGS_video);
VideoWidth(), params.video[camera_idx].width = VideoWidth();
VideoHeight(), params.video[camera_idx].height = VideoHeight();
VideoFps(), params.video[camera_idx].fps = VideoFps();
VideoMinBitrateKbps() * 1000, params.video[camera_idx].min_bitrate_bps = VideoMinBitrateKbps() * 1000;
VideoTargetBitrateKbps() * 1000, params.video[camera_idx].target_bitrate_bps = VideoTargetBitrateKbps() * 1000;
VideoMaxBitrateKbps() * 1000, params.video[camera_idx].max_bitrate_bps = VideoMaxBitrateKbps() * 1000;
absl::GetFlag(FLAGS_suspend_below_min_bitrate), params.video[camera_idx].suspend_below_min_bitrate =
Codec(), absl::GetFlag(FLAGS_suspend_below_min_bitrate);
VideoNumTemporalLayers(), params.video[camera_idx].codec = Codec();
VideoSelectedTL(), params.video[camera_idx].num_temporal_layers = VideoNumTemporalLayers();
0, // No min transmit bitrate. params.video[camera_idx].selected_tl = VideoSelectedTL();
absl::GetFlag(FLAGS_use_ulpfec), params.video[camera_idx].ulpfec = absl::GetFlag(FLAGS_use_ulpfec);
absl::GetFlag(FLAGS_use_flexfec), params.video[camera_idx].flexfec = absl::GetFlag(FLAGS_use_flexfec);
false, params.video[camera_idx].clip_path = VideoClip();
VideoClip(), params.video[camera_idx].capture_device_index = GetCaptureDevice();
GetCaptureDevice()}; params.audio.enabled = absl::GetFlag(FLAGS_audio);
params.audio = {absl::GetFlag(FLAGS_audio), params.audio.sync_video = absl::GetFlag(FLAGS_audio_video_sync);
absl::GetFlag(FLAGS_audio_video_sync), params.audio.dtx = absl::GetFlag(FLAGS_audio_dtx);
absl::GetFlag(FLAGS_audio_dtx)}; params.logging.rtc_event_log_name = RtcEventLogName();
params.logging = {RtcEventLogName(), RtpDumpName(), EncodedFramePath()}; params.logging.rtp_dump_name = RtpDumpName();
params.analyzer = {"dual_streams", 0.0, 0.0, DurationSecs(), params.logging.encoded_frame_base_path = EncodedFramePath();
OutputFilename(), GraphTitle()}; params.analyzer.test_label = "dual_streams";
params.analyzer.test_durations_secs = DurationSecs();
params.analyzer.graph_data_output_filename = OutputFilename();
params.analyzer.graph_title = GraphTitle();
params.config = pipe_config; params.config = pipe_config;
params.screenshare[camera_idx].enabled = false; params.screenshare[camera_idx].enabled = false;
params.screenshare[screenshare_idx] = {true, GenerateSlides(), params.screenshare[screenshare_idx].enabled = true;
SlideChangeInterval(), params.screenshare[screenshare_idx].generate_slides = GenerateSlides();
ScrollDuration(), Slides()}; params.screenshare[screenshare_idx].slide_change_interval =
SlideChangeInterval();
params.screenshare[screenshare_idx].scroll_duration = ScrollDuration();
params.screenshare[screenshare_idx].slides = Slides();
if (VideoNumStreams() > 1 && VideoStream0().empty() && if (VideoNumStreams() > 1 && VideoStream0().empty() &&
VideoStream1().empty()) { VideoStream1().empty()) {

View File

@ -376,33 +376,40 @@ void Loopback() {
call_bitrate_config.max_bitrate_bps = -1; // Don't cap bandwidth estimate. call_bitrate_config.max_bitrate_bps = -1; // Don't cap bandwidth estimate.
VideoQualityTest::Params params; VideoQualityTest::Params params;
params.call = {absl::GetFlag(FLAGS_send_side_bwe), params.call.send_side_bwe = absl::GetFlag(FLAGS_send_side_bwe);
absl::GetFlag(FLAGS_generic_descriptor), call_bitrate_config, params.call.generic_descriptor = absl::GetFlag(FLAGS_generic_descriptor);
0}; params.call.call_bitrate_config = call_bitrate_config;
params.video[0] = {absl::GetFlag(FLAGS_video),
Width(), params.video[0].enabled = absl::GetFlag(FLAGS_video);
Height(), params.video[0].width = Width();
Fps(), params.video[0].height = Height();
MinBitrateKbps() * 1000, params.video[0].fps = Fps();
TargetBitrateKbps() * 1000, params.video[0].min_bitrate_bps = MinBitrateKbps() * 1000;
MaxBitrateKbps() * 1000, params.video[0].target_bitrate_bps = TargetBitrateKbps() * 1000;
absl::GetFlag(FLAGS_suspend_below_min_bitrate), params.video[0].max_bitrate_bps = MaxBitrateKbps() * 1000;
Codec(), params.video[0].suspend_below_min_bitrate =
NumTemporalLayers(), absl::GetFlag(FLAGS_suspend_below_min_bitrate);
SelectedTL(), params.video[0].codec = Codec();
0, // No min transmit bitrate. params.video[0].num_temporal_layers = NumTemporalLayers();
absl::GetFlag(FLAGS_use_ulpfec), params.video[0].selected_tl = SelectedTL();
absl::GetFlag(FLAGS_use_flexfec), params.video[0].min_transmit_bps = 0;
NumStreams() < 2, // Automatic quality scaling. params.video[0].ulpfec = absl::GetFlag(FLAGS_use_ulpfec);
Clip(), params.video[0].flexfec = absl::GetFlag(FLAGS_use_flexfec);
GetCaptureDevice()}; params.video[0].automatic_scaling = NumStreams() < 2;
params.audio = { params.video[0].clip_path = Clip();
absl::GetFlag(FLAGS_audio), absl::GetFlag(FLAGS_audio_video_sync), params.video[0].capture_device_index = GetCaptureDevice();
absl::GetFlag(FLAGS_audio_dtx), absl::GetFlag(FLAGS_use_real_adm)}; params.audio.enabled = absl::GetFlag(FLAGS_audio);
params.logging = {RtcEventLogName(), RtpDumpName(), EncodedFramePath()}; params.audio.sync_video = absl::GetFlag(FLAGS_audio_video_sync);
params.audio.dtx = absl::GetFlag(FLAGS_audio_dtx);
params.audio.use_real_adm = absl::GetFlag(FLAGS_use_real_adm);
params.logging.rtc_event_log_name = RtcEventLogName();
params.logging.rtp_dump_name = RtpDumpName();
params.logging.encoded_frame_base_path = EncodedFramePath();
params.screenshare[0].enabled = false; params.screenshare[0].enabled = false;
params.analyzer = {"video", 0.0, 0.0, DurationSecs(), params.analyzer.test_label = "video";
OutputFilename(), GraphTitle()}; params.analyzer.test_durations_secs = DurationSecs();
params.analyzer.graph_data_output_filename = OutputFilename();
params.analyzer.graph_title = GraphTitle();
params.config = pipe_config; params.config = pipe_config;
if (NumStreams() > 1 && Stream0().empty() && Stream1().empty()) { if (NumStreams() > 1 && Stream0().empty() && Stream1().empty()) {

View File

@ -434,58 +434,6 @@ VideoQualityTest::VideoQualityTest(
std::move(injection_components_->network_controller_factory); std::move(injection_components_->network_controller_factory);
} }
VideoQualityTest::Params::Params()
: call({false, false, BitrateConstraints(), 0}),
video{{false,
640,
480,
30,
50,
800,
800,
false,
"VP8",
1,
-1,
0,
false,
false,
false,
"",
0,
{},
0.0},
{false,
640,
480,
30,
50,
800,
800,
false,
"VP8",
1,
-1,
0,
false,
false,
false,
"",
0,
{},
0.0}},
audio({false, false, false, false}),
screenshare{{false, false, 10, 0}, {false, false, 10, 0}},
analyzer({"", 0.0, 0.0, 0, "", ""}),
config(absl::nullopt),
ss{{std::vector<VideoStream>(), 0, 0, -1, InterLayerPredMode::kOn,
std::vector<SpatialLayer>()},
{std::vector<VideoStream>(), 0, 0, -1, InterLayerPredMode::kOn,
std::vector<SpatialLayer>()}},
logging({"", "", ""}) {}
VideoQualityTest::Params::~Params() = default;
VideoQualityTest::InjectionComponents::InjectionComponents() = default; VideoQualityTest::InjectionComponents::InjectionComponents() = default;
VideoQualityTest::InjectionComponents::~InjectionComponents() = default; VideoQualityTest::InjectionComponents::~InjectionComponents() = default;