webrtc_m130/video/screenshare_loopback.cc

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

391 lines
12 KiB
C++
Raw Normal View History

/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <stdio.h>
#include <memory>
#include <string>
#include <vector>
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "absl/types/optional.h"
#include "api/test/simulated_network.h"
#include "api/test/video_quality_test_fixture.h"
#include "api/transport/bitrate_settings.h"
#include "api/video_codecs/video_codec.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/string_encode.h"
#include "system_wrappers/include/field_trial.h"
#include "test/field_trial.h"
#include "test/gtest.h"
#include "test/run_test.h"
#include "video/video_quality_test.h"
using ::webrtc::BitrateConstraints;
using ::webrtc::BuiltInNetworkBehaviorConfig;
using ::webrtc::InterLayerPredMode;
using ::webrtc::SdpVideoFormat;
using ::webrtc::VideoQualityTest;
// Flags common with video loopback, with different default values.
ABSL_FLAG(int, width, 1850, "Video width (crops source).");
size_t Width() {
return static_cast<size_t>(absl::GetFlag(FLAGS_width));
}
ABSL_FLAG(int, height, 1110, "Video height (crops source).");
size_t Height() {
return static_cast<size_t>(absl::GetFlag(FLAGS_height));
}
ABSL_FLAG(int, fps, 5, "Frames per second.");
int Fps() {
return absl::GetFlag(FLAGS_fps);
}
ABSL_FLAG(int, min_bitrate, 50, "Call and stream min bitrate in kbps.");
Refactoring full stack and loopback tests Refactoring full stack, video and screenshare tests to use the same code basis for parametrization and initialization. This patch is done on top of recently commited full stack graphs CL https://codereview.webrtc.org/1289933003/, but virtually no changes have been made to full_stack_plot.py nor to the VideoAnalyzer in full stack, except moving it to video_quality_test.cc. Also, full_stack_samples.cc (build target) was removed and replaced with -output_filename and -duration cmdline arguments in video_loopback and screenshare_loopback. The important things to review: - video_quality_test.h Is the structure of Params good? (examples of usage can be found in full_stack.cc, video_loopback.cc and screenshare_loopback.cc) - video_quality_test.cc Is the initialization correct? The case for using Analyzer and using local renderer are different, can they be further merged? - webrtc_tests.gypi Reproducing the different bitrate settings the full stack and loopback tests had was a little bit tricky. To support both simultaneously, I added BitrateConfig to the Params struct, as well as separate start_bitrate and target_bitrate flags for loopback tests. Note: Side-by-side diff for video_quality_test.cc compares that file directly with the old full_stack.cc, so changes to VideoAnalyzer are clearly visible. Note: Recent CL I've committed added -num_temporal_layers and -sl_discard_threshold args to loopback tests. This was removed here. Support for streams and SVC will be added in a CL following this one. Review URL: https://codereview.webrtc.org/1308403003 Cr-Commit-Position: refs/heads/master@{#9969}
2015-09-17 05:30:24 -07:00
int MinBitrateKbps() {
return absl::GetFlag(FLAGS_min_bitrate);
}
ABSL_FLAG(int, start_bitrate, 300, "Call start bitrate in kbps.");
Refactoring full stack and loopback tests Refactoring full stack, video and screenshare tests to use the same code basis for parametrization and initialization. This patch is done on top of recently commited full stack graphs CL https://codereview.webrtc.org/1289933003/, but virtually no changes have been made to full_stack_plot.py nor to the VideoAnalyzer in full stack, except moving it to video_quality_test.cc. Also, full_stack_samples.cc (build target) was removed and replaced with -output_filename and -duration cmdline arguments in video_loopback and screenshare_loopback. The important things to review: - video_quality_test.h Is the structure of Params good? (examples of usage can be found in full_stack.cc, video_loopback.cc and screenshare_loopback.cc) - video_quality_test.cc Is the initialization correct? The case for using Analyzer and using local renderer are different, can they be further merged? - webrtc_tests.gypi Reproducing the different bitrate settings the full stack and loopback tests had was a little bit tricky. To support both simultaneously, I added BitrateConfig to the Params struct, as well as separate start_bitrate and target_bitrate flags for loopback tests. Note: Side-by-side diff for video_quality_test.cc compares that file directly with the old full_stack.cc, so changes to VideoAnalyzer are clearly visible. Note: Recent CL I've committed added -num_temporal_layers and -sl_discard_threshold args to loopback tests. This was removed here. Support for streams and SVC will be added in a CL following this one. Review URL: https://codereview.webrtc.org/1308403003 Cr-Commit-Position: refs/heads/master@{#9969}
2015-09-17 05:30:24 -07:00
int StartBitrateKbps() {
return absl::GetFlag(FLAGS_start_bitrate);
}
ABSL_FLAG(int, target_bitrate, 200, "Stream target bitrate in kbps.");
Refactoring full stack and loopback tests Refactoring full stack, video and screenshare tests to use the same code basis for parametrization and initialization. This patch is done on top of recently commited full stack graphs CL https://codereview.webrtc.org/1289933003/, but virtually no changes have been made to full_stack_plot.py nor to the VideoAnalyzer in full stack, except moving it to video_quality_test.cc. Also, full_stack_samples.cc (build target) was removed and replaced with -output_filename and -duration cmdline arguments in video_loopback and screenshare_loopback. The important things to review: - video_quality_test.h Is the structure of Params good? (examples of usage can be found in full_stack.cc, video_loopback.cc and screenshare_loopback.cc) - video_quality_test.cc Is the initialization correct? The case for using Analyzer and using local renderer are different, can they be further merged? - webrtc_tests.gypi Reproducing the different bitrate settings the full stack and loopback tests had was a little bit tricky. To support both simultaneously, I added BitrateConfig to the Params struct, as well as separate start_bitrate and target_bitrate flags for loopback tests. Note: Side-by-side diff for video_quality_test.cc compares that file directly with the old full_stack.cc, so changes to VideoAnalyzer are clearly visible. Note: Recent CL I've committed added -num_temporal_layers and -sl_discard_threshold args to loopback tests. This was removed here. Support for streams and SVC will be added in a CL following this one. Review URL: https://codereview.webrtc.org/1308403003 Cr-Commit-Position: refs/heads/master@{#9969}
2015-09-17 05:30:24 -07:00
int TargetBitrateKbps() {
return absl::GetFlag(FLAGS_target_bitrate);
}
ABSL_FLAG(int, max_bitrate, 1000, "Call and stream max bitrate in kbps.");
Refactoring full stack and loopback tests Refactoring full stack, video and screenshare tests to use the same code basis for parametrization and initialization. This patch is done on top of recently commited full stack graphs CL https://codereview.webrtc.org/1289933003/, but virtually no changes have been made to full_stack_plot.py nor to the VideoAnalyzer in full stack, except moving it to video_quality_test.cc. Also, full_stack_samples.cc (build target) was removed and replaced with -output_filename and -duration cmdline arguments in video_loopback and screenshare_loopback. The important things to review: - video_quality_test.h Is the structure of Params good? (examples of usage can be found in full_stack.cc, video_loopback.cc and screenshare_loopback.cc) - video_quality_test.cc Is the initialization correct? The case for using Analyzer and using local renderer are different, can they be further merged? - webrtc_tests.gypi Reproducing the different bitrate settings the full stack and loopback tests had was a little bit tricky. To support both simultaneously, I added BitrateConfig to the Params struct, as well as separate start_bitrate and target_bitrate flags for loopback tests. Note: Side-by-side diff for video_quality_test.cc compares that file directly with the old full_stack.cc, so changes to VideoAnalyzer are clearly visible. Note: Recent CL I've committed added -num_temporal_layers and -sl_discard_threshold args to loopback tests. This was removed here. Support for streams and SVC will be added in a CL following this one. Review URL: https://codereview.webrtc.org/1308403003 Cr-Commit-Position: refs/heads/master@{#9969}
2015-09-17 05:30:24 -07:00
int MaxBitrateKbps() {
return absl::GetFlag(FLAGS_max_bitrate);
}
ABSL_FLAG(int, num_temporal_layers, 2, "Number of temporal layers to use.");
int NumTemporalLayers() {
return absl::GetFlag(FLAGS_num_temporal_layers);
}
// Flags common with video loopback, with equal default values.
ABSL_FLAG(std::string, codec, "VP8", "Video codec to use.");
std::string Codec() {
return absl::GetFlag(FLAGS_codec);
}
ABSL_FLAG(std::string,
rtc_event_log_name,
"",
"Filename for rtc event log. Two files "
"with \"_send\" and \"_recv\" suffixes will be created.");
std::string RtcEventLogName() {
return absl::GetFlag(FLAGS_rtc_event_log_name);
}
ABSL_FLAG(std::string,
rtp_dump_name,
"",
"Filename for dumped received RTP stream.");
std::string RtpDumpName() {
return absl::GetFlag(FLAGS_rtp_dump_name);
}
ABSL_FLAG(int,
selected_tl,
-1,
"Temporal layer to show or analyze. -1 to disable filtering.");
int SelectedTL() {
return absl::GetFlag(FLAGS_selected_tl);
}
ABSL_FLAG(
int,
duration,
0,
"Duration of the test in seconds. If 0, rendered will be shown instead.");
int DurationSecs() {
return absl::GetFlag(FLAGS_duration);
}
ABSL_FLAG(std::string, output_filename, "", "Target graph data filename.");
std::string OutputFilename() {
return absl::GetFlag(FLAGS_output_filename);
}
ABSL_FLAG(std::string,
graph_title,
"",
"If empty, title will be generated automatically.");
std::string GraphTitle() {
return absl::GetFlag(FLAGS_graph_title);
}
ABSL_FLAG(int, loss_percent, 0, "Percentage of packets randomly lost.");
int LossPercent() {
return absl::GetFlag(FLAGS_loss_percent);
}
ABSL_FLAG(int,
link_capacity,
0,
"Capacity (kbps) of the fake link. 0 means infinite.");
Refactoring full stack and loopback tests Refactoring full stack, video and screenshare tests to use the same code basis for parametrization and initialization. This patch is done on top of recently commited full stack graphs CL https://codereview.webrtc.org/1289933003/, but virtually no changes have been made to full_stack_plot.py nor to the VideoAnalyzer in full stack, except moving it to video_quality_test.cc. Also, full_stack_samples.cc (build target) was removed and replaced with -output_filename and -duration cmdline arguments in video_loopback and screenshare_loopback. The important things to review: - video_quality_test.h Is the structure of Params good? (examples of usage can be found in full_stack.cc, video_loopback.cc and screenshare_loopback.cc) - video_quality_test.cc Is the initialization correct? The case for using Analyzer and using local renderer are different, can they be further merged? - webrtc_tests.gypi Reproducing the different bitrate settings the full stack and loopback tests had was a little bit tricky. To support both simultaneously, I added BitrateConfig to the Params struct, as well as separate start_bitrate and target_bitrate flags for loopback tests. Note: Side-by-side diff for video_quality_test.cc compares that file directly with the old full_stack.cc, so changes to VideoAnalyzer are clearly visible. Note: Recent CL I've committed added -num_temporal_layers and -sl_discard_threshold args to loopback tests. This was removed here. Support for streams and SVC will be added in a CL following this one. Review URL: https://codereview.webrtc.org/1308403003 Cr-Commit-Position: refs/heads/master@{#9969}
2015-09-17 05:30:24 -07:00
int LinkCapacityKbps() {
return absl::GetFlag(FLAGS_link_capacity);
}
ABSL_FLAG(int, queue_size, 0, "Size of the bottleneck link queue in packets.");
int QueueSize() {
return absl::GetFlag(FLAGS_queue_size);
}
ABSL_FLAG(int,
avg_propagation_delay_ms,
0,
"Average link propagation delay in ms.");
int AvgPropagationDelayMs() {
return absl::GetFlag(FLAGS_avg_propagation_delay_ms);
}
ABSL_FLAG(int,
std_propagation_delay_ms,
0,
"Link propagation delay standard deviation in ms.");
int StdPropagationDelayMs() {
return absl::GetFlag(FLAGS_std_propagation_delay_ms);
}
ABSL_FLAG(int, num_streams, 0, "Number of streams to show or analyze.");
int NumStreams() {
return absl::GetFlag(FLAGS_num_streams);
}
ABSL_FLAG(int,
selected_stream,
0,
"ID of the stream to show or analyze. "
"Set to the number of streams to show them all.");
int SelectedStream() {
return absl::GetFlag(FLAGS_selected_stream);
}
ABSL_FLAG(int, num_spatial_layers, 1, "Number of spatial layers to use.");
int NumSpatialLayers() {
return absl::GetFlag(FLAGS_num_spatial_layers);
Refactoring full stack and loopback tests Refactoring full stack, video and screenshare tests to use the same code basis for parametrization and initialization. This patch is done on top of recently commited full stack graphs CL https://codereview.webrtc.org/1289933003/, but virtually no changes have been made to full_stack_plot.py nor to the VideoAnalyzer in full stack, except moving it to video_quality_test.cc. Also, full_stack_samples.cc (build target) was removed and replaced with -output_filename and -duration cmdline arguments in video_loopback and screenshare_loopback. The important things to review: - video_quality_test.h Is the structure of Params good? (examples of usage can be found in full_stack.cc, video_loopback.cc and screenshare_loopback.cc) - video_quality_test.cc Is the initialization correct? The case for using Analyzer and using local renderer are different, can they be further merged? - webrtc_tests.gypi Reproducing the different bitrate settings the full stack and loopback tests had was a little bit tricky. To support both simultaneously, I added BitrateConfig to the Params struct, as well as separate start_bitrate and target_bitrate flags for loopback tests. Note: Side-by-side diff for video_quality_test.cc compares that file directly with the old full_stack.cc, so changes to VideoAnalyzer are clearly visible. Note: Recent CL I've committed added -num_temporal_layers and -sl_discard_threshold args to loopback tests. This was removed here. Support for streams and SVC will be added in a CL following this one. Review URL: https://codereview.webrtc.org/1308403003 Cr-Commit-Position: refs/heads/master@{#9969}
2015-09-17 05:30:24 -07:00
}
ABSL_FLAG(int,
inter_layer_pred,
0,
"Inter-layer prediction mode. "
"0 - enabled, 1 - disabled, 2 - enabled only for key pictures.");
InterLayerPredMode InterLayerPred() {
if (absl::GetFlag(FLAGS_inter_layer_pred) == 0) {
return webrtc::InterLayerPredMode::kOn;
} else if (absl::GetFlag(FLAGS_inter_layer_pred) == 1) {
return webrtc::InterLayerPredMode::kOff;
} else {
RTC_DCHECK_EQ(absl::GetFlag(FLAGS_inter_layer_pred), 2);
return webrtc::InterLayerPredMode::kOnKeyPic;
}
}
ABSL_FLAG(int,
selected_sl,
-1,
"Spatial layer to show or analyze. -1 to disable filtering.");
int SelectedSL() {
return absl::GetFlag(FLAGS_selected_sl);
}
ABSL_FLAG(std::string,
stream0,
"",
"Comma separated values describing VideoStream for stream #0.");
std::string Stream0() {
return absl::GetFlag(FLAGS_stream0);
Refactoring full stack and loopback tests Refactoring full stack, video and screenshare tests to use the same code basis for parametrization and initialization. This patch is done on top of recently commited full stack graphs CL https://codereview.webrtc.org/1289933003/, but virtually no changes have been made to full_stack_plot.py nor to the VideoAnalyzer in full stack, except moving it to video_quality_test.cc. Also, full_stack_samples.cc (build target) was removed and replaced with -output_filename and -duration cmdline arguments in video_loopback and screenshare_loopback. The important things to review: - video_quality_test.h Is the structure of Params good? (examples of usage can be found in full_stack.cc, video_loopback.cc and screenshare_loopback.cc) - video_quality_test.cc Is the initialization correct? The case for using Analyzer and using local renderer are different, can they be further merged? - webrtc_tests.gypi Reproducing the different bitrate settings the full stack and loopback tests had was a little bit tricky. To support both simultaneously, I added BitrateConfig to the Params struct, as well as separate start_bitrate and target_bitrate flags for loopback tests. Note: Side-by-side diff for video_quality_test.cc compares that file directly with the old full_stack.cc, so changes to VideoAnalyzer are clearly visible. Note: Recent CL I've committed added -num_temporal_layers and -sl_discard_threshold args to loopback tests. This was removed here. Support for streams and SVC will be added in a CL following this one. Review URL: https://codereview.webrtc.org/1308403003 Cr-Commit-Position: refs/heads/master@{#9969}
2015-09-17 05:30:24 -07:00
}
ABSL_FLAG(std::string,
stream1,
"",
"Comma separated values describing VideoStream for stream #1.");
std::string Stream1() {
return absl::GetFlag(FLAGS_stream1);
}
ABSL_FLAG(std::string,
sl0,
"",
"Comma separated values describing SpatialLayer for layer #0.");
std::string SL0() {
return absl::GetFlag(FLAGS_sl0);
}
ABSL_FLAG(std::string,
sl1,
"",
"Comma separated values describing SpatialLayer for layer #1.");
std::string SL1() {
return absl::GetFlag(FLAGS_sl1);
}
ABSL_FLAG(std::string,
encoded_frame_path,
"",
"The base path for encoded frame logs. Created files will have "
"the form <encoded_frame_path>.<n>.(recv|send.<m>).ivf");
std::string EncodedFramePath() {
return absl::GetFlag(FLAGS_encoded_frame_path);
}
ABSL_FLAG(bool, logs, false, "print logs to stderr");
ABSL_FLAG(bool, send_side_bwe, true, "Use send-side bandwidth estimation");
ABSL_FLAG(bool, generic_descriptor, false, "Use the generic frame descriptor.");
Reland "Added field trial WebRTC-GenericDescriptor for the new generic descriptor." This reverts commit 6f68324adbf52b247e10b33a4e83a586e66cc6df. Reason for revert: Removed full stack tests that cause timeout. Original change's description: > Revert "Added field trial WebRTC-GenericDescriptor for the new generic descriptor." > > This reverts commit 3f4a4fad8cd661309ff5d9a631e89518f32e7c5e. > > Reason for revert: Breaking internal tests > > Original change's description: > > Added field trial WebRTC-GenericDescriptor for the new generic descriptor. > > > > Also parameterized tests to test the new generic descriptor and > > added --generic_descriptor flag to loopback tests. > > > > Bug: webrtc:9361 > > Change-Id: I2b76889606fe2e81249ecdebb0b7b61151682485 > > Reviewed-on: https://webrtc-review.googlesource.com/101900 > > Commit-Queue: Philip Eliasson <philipel@webrtc.org> > > Reviewed-by: Erik Språng <sprang@webrtc.org> > > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#24835} > > TBR=danilchap@webrtc.org,sprang@webrtc.org,stefan@webrtc.org,philipel@webrtc.org > > Change-Id: I4d4714a9f4ab0e95adf0f4130bc1a932efc448fa > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9361 > Reviewed-on: https://webrtc-review.googlesource.com/101940 > Reviewed-by: Lu Liu <lliuu@webrtc.org> > Commit-Queue: Lu Liu <lliuu@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#24839} TBR=danilchap@webrtc.org,sprang@webrtc.org,stefan@webrtc.org,philipel@webrtc.org,lliuu@webrtc.org Change-Id: Ibcf0a1d3aa947b84e3b891b1975d0fc2c730f2ae No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:9361 Reviewed-on: https://webrtc-review.googlesource.com/102064 Commit-Queue: Philip Eliasson <philipel@webrtc.org> Reviewed-by: Philip Eliasson <philipel@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24845}
2018-09-26 12:25:31 +02:00
ABSL_FLAG(bool, allow_reordering, false, "Allow packet reordering to occur");
ABSL_FLAG(
std::string,
force_fieldtrials,
"",
"Field trials control experimental feature code which can be forced. "
"E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
" will assign the group Enable to field trial WebRTC-FooFeature. Multiple "
"trials are separated by \"/\"");
// Screenshare-specific flags.
ABSL_FLAG(int,
min_transmit_bitrate,
400,
"Min transmit bitrate incl. padding.");
int MinTransmitBitrateKbps() {
return absl::GetFlag(FLAGS_min_transmit_bitrate);
}
ABSL_FLAG(bool,
generate_slides,
false,
"Whether to use randomly generated slides or read them from files.");
bool GenerateSlides() {
return absl::GetFlag(FLAGS_generate_slides);
}
ABSL_FLAG(int,
slide_change_interval,
10,
"Interval (in seconds) between simulated slide changes.");
int SlideChangeInterval() {
return absl::GetFlag(FLAGS_slide_change_interval);
}
ABSL_FLAG(
int,
scroll_duration,
0,
"Duration (in seconds) during which a slide will be scrolled into place.");
int ScrollDuration() {
return absl::GetFlag(FLAGS_scroll_duration);
}
ABSL_FLAG(std::string,
slides,
"",
"Comma-separated list of *.yuv files to display as slides.");
std::vector<std::string> Slides() {
std::vector<std::string> slides;
std::string slides_list = absl::GetFlag(FLAGS_slides);
rtc::tokenize(slides_list, ',', &slides);
return slides;
}
void Loopback() {
BuiltInNetworkBehaviorConfig pipe_config;
pipe_config.loss_percent = LossPercent();
pipe_config.link_capacity_kbps = LinkCapacityKbps();
pipe_config.queue_length_packets = QueueSize();
pipe_config.queue_delay_ms = AvgPropagationDelayMs();
pipe_config.delay_standard_deviation_ms = StdPropagationDelayMs();
pipe_config.allow_reordering = absl::GetFlag(FLAGS_allow_reordering);
Refactoring full stack and loopback tests Refactoring full stack, video and screenshare tests to use the same code basis for parametrization and initialization. This patch is done on top of recently commited full stack graphs CL https://codereview.webrtc.org/1289933003/, but virtually no changes have been made to full_stack_plot.py nor to the VideoAnalyzer in full stack, except moving it to video_quality_test.cc. Also, full_stack_samples.cc (build target) was removed and replaced with -output_filename and -duration cmdline arguments in video_loopback and screenshare_loopback. The important things to review: - video_quality_test.h Is the structure of Params good? (examples of usage can be found in full_stack.cc, video_loopback.cc and screenshare_loopback.cc) - video_quality_test.cc Is the initialization correct? The case for using Analyzer and using local renderer are different, can they be further merged? - webrtc_tests.gypi Reproducing the different bitrate settings the full stack and loopback tests had was a little bit tricky. To support both simultaneously, I added BitrateConfig to the Params struct, as well as separate start_bitrate and target_bitrate flags for loopback tests. Note: Side-by-side diff for video_quality_test.cc compares that file directly with the old full_stack.cc, so changes to VideoAnalyzer are clearly visible. Note: Recent CL I've committed added -num_temporal_layers and -sl_discard_threshold args to loopback tests. This was removed here. Support for streams and SVC will be added in a CL following this one. Review URL: https://codereview.webrtc.org/1308403003 Cr-Commit-Position: refs/heads/master@{#9969}
2015-09-17 05:30:24 -07:00
BitrateConstraints call_bitrate_config;
call_bitrate_config.min_bitrate_bps = MinBitrateKbps() * 1000;
call_bitrate_config.start_bitrate_bps = StartBitrateKbps() * 1000;
call_bitrate_config.max_bitrate_bps = -1; // Don't cap bandwidth estimate.
Refactoring full stack and loopback tests Refactoring full stack, video and screenshare tests to use the same code basis for parametrization and initialization. This patch is done on top of recently commited full stack graphs CL https://codereview.webrtc.org/1289933003/, but virtually no changes have been made to full_stack_plot.py nor to the VideoAnalyzer in full stack, except moving it to video_quality_test.cc. Also, full_stack_samples.cc (build target) was removed and replaced with -output_filename and -duration cmdline arguments in video_loopback and screenshare_loopback. The important things to review: - video_quality_test.h Is the structure of Params good? (examples of usage can be found in full_stack.cc, video_loopback.cc and screenshare_loopback.cc) - video_quality_test.cc Is the initialization correct? The case for using Analyzer and using local renderer are different, can they be further merged? - webrtc_tests.gypi Reproducing the different bitrate settings the full stack and loopback tests had was a little bit tricky. To support both simultaneously, I added BitrateConfig to the Params struct, as well as separate start_bitrate and target_bitrate flags for loopback tests. Note: Side-by-side diff for video_quality_test.cc compares that file directly with the old full_stack.cc, so changes to VideoAnalyzer are clearly visible. Note: Recent CL I've committed added -num_temporal_layers and -sl_discard_threshold args to loopback tests. This was removed here. Support for streams and SVC will be added in a CL following this one. Review URL: https://codereview.webrtc.org/1308403003 Cr-Commit-Position: refs/heads/master@{#9969}
2015-09-17 05:30:24 -07:00
VideoQualityTest::Params params;
params.call = {absl::GetFlag(FLAGS_send_side_bwe),
absl::GetFlag(FLAGS_generic_descriptor), call_bitrate_config};
params.video[0] = {true,
Width(),
Height(),
Fps(),
MinBitrateKbps() * 1000,
TargetBitrateKbps() * 1000,
MaxBitrateKbps() * 1000,
false,
Codec(),
NumTemporalLayers(),
SelectedTL(),
MinTransmitBitrateKbps() * 1000,
false, // ULPFEC disabled.
false, // FlexFEC disabled.
false, // Automatic scaling disabled.
"",
0, // capture_device_index.
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.logging = {RtcEventLogName(), RtpDumpName(), EncodedFramePath()};
Refactoring full stack and loopback tests Refactoring full stack, video and screenshare tests to use the same code basis for parametrization and initialization. This patch is done on top of recently commited full stack graphs CL https://codereview.webrtc.org/1289933003/, but virtually no changes have been made to full_stack_plot.py nor to the VideoAnalyzer in full stack, except moving it to video_quality_test.cc. Also, full_stack_samples.cc (build target) was removed and replaced with -output_filename and -duration cmdline arguments in video_loopback and screenshare_loopback. The important things to review: - video_quality_test.h Is the structure of Params good? (examples of usage can be found in full_stack.cc, video_loopback.cc and screenshare_loopback.cc) - video_quality_test.cc Is the initialization correct? The case for using Analyzer and using local renderer are different, can they be further merged? - webrtc_tests.gypi Reproducing the different bitrate settings the full stack and loopback tests had was a little bit tricky. To support both simultaneously, I added BitrateConfig to the Params struct, as well as separate start_bitrate and target_bitrate flags for loopback tests. Note: Side-by-side diff for video_quality_test.cc compares that file directly with the old full_stack.cc, so changes to VideoAnalyzer are clearly visible. Note: Recent CL I've committed added -num_temporal_layers and -sl_discard_threshold args to loopback tests. This was removed here. Support for streams and SVC will be added in a CL following this one. Review URL: https://codereview.webrtc.org/1308403003 Cr-Commit-Position: refs/heads/master@{#9969}
2015-09-17 05:30:24 -07:00
if (NumStreams() > 1 && Stream0().empty() && Stream1().empty()) {
params.ss[0].infer_streams = true;
}
std::vector<std::string> stream_descriptors;
stream_descriptors.push_back(Stream0());
stream_descriptors.push_back(Stream1());
std::vector<std::string> SL_descriptors;
SL_descriptors.push_back(SL0());
SL_descriptors.push_back(SL1());
VideoQualityTest::FillScalabilitySettings(
&params, 0, stream_descriptors, NumStreams(), SelectedStream(),
NumSpatialLayers(), SelectedSL(), InterLayerPred(), SL_descriptors);
Use std::make_unique instead of absl::make_unique. WebRTC is now using C++14 so there is no need to use the Abseil version of std::make_unique. This CL has been created with the following steps: git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \ uniq > /tmp/only_make_unique.txt diff --new-line-format="" --unchanged-line-format="" \ /tmp/only_make_unique.txt /tmp/memory.txt | \ xargs grep -l "absl/memory" > /tmp/add-memory.txt git grep -l "\babsl::make_unique\b" | \ xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g" git checkout PRESUBMIT.py abseil-in-webrtc.md cat /tmp/add-memory.txt | \ xargs sed -i \ 's/#include "absl\/memory\/memory.h"/#include <memory>/g' git cl format # Manual fix order of the new inserted #include <memory> cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \ xargs sed -i '/#include "absl\/memory\/memory.h"/d' git ls-files | grep BUILD.gn | \ xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d' python tools_webrtc/gn_check_autofix.py \ -m tryserver.webrtc -b linux_rel # Repead the gn_check_autofix step for other platforms git ls-files | grep BUILD.gn | \ xargs sed -i 's/absl\/memory:memory/absl\/memory/g' git cl format Bug: webrtc:10945 Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 17:06:18 +02:00
auto fixture = std::make_unique<VideoQualityTest>(nullptr);
if (DurationSecs()) {
fixture->RunWithAnalyzer(params);
} else {
fixture->RunWithRenderers(params);
}
}
int main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
absl::ParseCommandLine(argc, argv);
rtc::LogMessage::SetLogToStderr(absl::GetFlag(FLAGS_logs));
// InitFieldTrialsFromString stores the char*, so the char array must outlive
// the application.
const std::string field_trials = absl::GetFlag(FLAGS_force_fieldtrials);
webrtc::field_trial::InitFieldTrialsFromString(field_trials.c_str());
webrtc::test::RunTest(Loopback);
return 0;
}