Convert video quality test from a TEST_F to a TEST fixture.

The purpose is to make the fixture reusable in downstream
projects. The CL adds the following things to API:

- api/test/video_quality_test_fixture.h
- api/test/create_video_quality_test_fixture.h

The following things are moved to API:

- call/bitrate_constraints.h (api/bitrate_constraints.h)
- call/simulated_network.h (api/test/simulated_network.h)
- call/media_type.h (api/mediatypes.h)

These are required by the params struct passed to the
fixture. I didn't attempt to split the params struct into
an internal-only and public version in this CL, and as
a result we need to pull in the above things. They are
quite harmless though, so I think it's worth it in order
to avoid splitting up the test config struct.

This CL doesn't solve all the problems we need to
implement downstream tests; we probably need to upstream
tracing variants of FakeNetworkPipe for instance, but
that will come later. This puts in place the basic
structure for now.

Bug: None
Change-Id: I35e26ed126fad27bc7b2a465400291084f6ac911
Reviewed-on: https://webrtc-review.googlesource.com/69601
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23714}
This commit is contained in:
Patrik Höglund 2018-06-21 16:58:01 +02:00 committed by Commit Bot
parent 97899a09fb
commit b6b29e0718
23 changed files with 721 additions and 430 deletions

View file

@ -48,6 +48,7 @@ rtc_static_library("libjingle_peerconnection_api") {
visibility = [ "*" ]
cflags = []
sources = [
"bitrate_constraints.h",
"candidate.cc",
"candidate.h",
"cryptoparams.h",
@ -130,6 +131,48 @@ rtc_static_library("libjingle_peerconnection_api") {
}
}
rtc_source_set("video_quality_test_fixture_api") {
visibility = [ "*" ]
testonly = true
sources = [
"test/video_quality_test_fixture.h",
]
deps = [
":libjingle_peerconnection_api",
":simulated_network_api",
"../call:fake_network",
"../call:rtp_interfaces",
"../test:test_common",
"../test:video_test_common",
"video_codecs:video_codecs_api",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
if (rtc_include_tests) {
rtc_source_set("create_video_quality_test_fixture_api") {
visibility = [ "*" ]
testonly = true
sources = [
"test/create_video_quality_test_fixture.cc",
"test/create_video_quality_test_fixture.h",
]
deps = [
":fec_controller_api",
":video_quality_test_fixture_api",
"../rtc_base:ptr_util",
"../video:video_quality_test",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
}
rtc_source_set("libjingle_logging_api") {
visibility = [ "*" ]
sources = [
@ -207,6 +250,18 @@ rtc_source_set("transport_api") {
]
}
rtc_source_set("simulated_network_api") {
visibility = [ "*" ]
sources = [
"test/simulated_network.h",
]
deps = [
":optional",
"../rtc_base:criticalsection",
"../rtc_base:rtc_base",
]
}
rtc_source_set("fec_controller_api") {
visibility = [ "*" ]
sources = [

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef CALL_BITRATE_CONSTRAINTS_H_
#define CALL_BITRATE_CONSTRAINTS_H_
#ifndef API_BITRATE_CONSTRAINTS_H_
#define API_BITRATE_CONSTRAINTS_H_
#include <algorithm>
@ -38,4 +38,4 @@ static T MinPositive(T a, T b) {
return std::min(a, b);
}
} // namespace webrtc
#endif // CALL_BITRATE_CONSTRAINTS_H_
#endif // API_BITRATE_CONSTRAINTS_H_

View file

@ -13,6 +13,9 @@
#include <string>
// The cricket and webrtc have separate definitions for what a media type is.
// They're not compatible. Watch out for this.
namespace cricket {
enum MediaType { MEDIA_TYPE_AUDIO, MEDIA_TYPE_VIDEO, MEDIA_TYPE_DATA };
@ -24,4 +27,10 @@ MediaType MediaTypeFromString(const std::string& type_str);
} // namespace cricket
namespace webrtc {
enum class MediaType { ANY, AUDIO, VIDEO, DATA };
} // namespace webrtc
#endif // API_MEDIATYPES_H_

View file

@ -2,4 +2,7 @@ specific_include_rules = {
".*": [
"+modules/video_coding",
],
".*": [
"+video"
],
}

View file

@ -0,0 +1,34 @@
/*
* Copyright (c) 2018 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 <memory>
#include <utility>
#include "api/test/create_video_quality_test_fixture.h"
#include "video/video_quality_test.h"
#include "rtc_base/ptr_util.h"
namespace webrtc {
std::unique_ptr<VideoQualityTestFixtureInterface>
CreateVideoQualityTestFixture() {
// By default, we don't override the FEC module, so pass an empty factory.
return rtc::MakeUnique<VideoQualityTest>(nullptr);
}
std::unique_ptr<VideoQualityTestFixtureInterface>
CreateVideoQualityTestFixture(
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory) {
return rtc::MakeUnique<VideoQualityTest>(std::move(fec_controller_factory));
}
} // namespace webrtc

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2018 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.
*/
#ifndef API_TEST_CREATE_VIDEO_QUALITY_TEST_FIXTURE_H_
#define API_TEST_CREATE_VIDEO_QUALITY_TEST_FIXTURE_H_
#include <memory>
#include "api/fec_controller.h"
#include "api/test/video_quality_test_fixture.h"
namespace webrtc {
std::unique_ptr<VideoQualityTestFixtureInterface>
CreateVideoQualityTestFixture();
std::unique_ptr<VideoQualityTestFixtureInterface>
CreateVideoQualityTestFixture(
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory);
}
#endif // API_TEST_CREATE_VIDEO_QUALITY_TEST_FIXTURE_H_

View file

@ -0,0 +1,77 @@
/*
* Copyright (c) 2018 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.
*/
#ifndef API_TEST_SIMULATED_NETWORK_H_
#define API_TEST_SIMULATED_NETWORK_H_
#include <stddef.h>
#include <stdint.h>
#include <deque>
#include <queue>
#include <vector>
#include "api/optional.h"
#include "rtc_base/criticalsection.h"
#include "rtc_base/random.h"
#include "rtc_base/thread_annotations.h"
namespace webrtc {
struct PacketInFlightInfo {
PacketInFlightInfo(size_t size, int64_t send_time_us, uint64_t packet_id)
: size(size), send_time_us(send_time_us), packet_id(packet_id) {}
size_t size;
int64_t send_time_us;
// Unique identifier for the packet in relation to other packets in flight.
uint64_t packet_id;
};
struct PacketDeliveryInfo {
static constexpr int kNotReceived = -1;
PacketDeliveryInfo(PacketInFlightInfo source, int64_t receive_time_us)
: receive_time_us(receive_time_us), packet_id(source.packet_id) {}
int64_t receive_time_us;
uint64_t packet_id;
};
class NetworkSimulationInterface {
public:
// TODO(phoglund): this one shouldn't really be here; make fake network pipes
// injectable instead in the video quality test fixture.
struct SimulatedNetworkConfig {
SimulatedNetworkConfig() {}
// Queue length in number of packets.
size_t queue_length_packets = 0;
// Delay in addition to capacity induced delay.
int queue_delay_ms = 0;
// Standard deviation of the extra delay.
int delay_standard_deviation_ms = 0;
// Link capacity in kbps.
int link_capacity_kbps = 0;
// Random packet loss.
int loss_percent = 0;
// If packets are allowed to be reordered.
bool allow_reordering = false;
// The average length of a burst of lost packets.
int avg_burst_loss_length = -1;
};
virtual bool EnqueuePacket(PacketInFlightInfo packet_info) = 0;
// Retrieves all packets that should be delivered by the given receive time.
virtual std::vector<PacketDeliveryInfo> DequeueDeliverablePackets(
int64_t receive_time_us) = 0;
virtual absl::optional<int64_t> NextDeliveryTimeUs() const = 0;
virtual ~NetworkSimulationInterface() = default;
};
} // namespace webrtc
#endif // API_TEST_SIMULATED_NETWORK_H_

View file

@ -0,0 +1,111 @@
/*
* Copyright (c) 2018 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.
*/
#ifndef API_TEST_VIDEO_QUALITY_TEST_FIXTURE_H_
#define API_TEST_VIDEO_QUALITY_TEST_FIXTURE_H_
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "api/bitrate_constraints.h"
#include "api/mediatypes.h"
#include "api/test/simulated_network.h"
#include "api/video_codecs/video_encoder_config.h"
namespace webrtc {
class VideoQualityTestFixtureInterface {
public:
// Parameters are grouped into smaller structs to make it easier to set
// the desired elements and skip unused, using aggregate initialization.
// Unfortunately, C++11 (as opposed to C11) doesn't support unnamed structs,
// which makes the implementation of VideoQualityTest a bit uglier.
struct Params {
Params();
~Params();
struct CallConfig {
bool send_side_bwe;
BitrateConstraints call_bitrate_config;
int num_thumbnails;
// Indicates if secondary_(video|ss|screenshare) structures are used.
bool dual_video;
} call;
struct Video {
bool enabled;
size_t width;
size_t height;
int32_t fps;
int min_bitrate_bps;
int target_bitrate_bps;
int max_bitrate_bps;
bool suspend_below_min_bitrate;
std::string codec;
int num_temporal_layers;
int selected_tl;
int min_transmit_bps;
bool ulpfec;
bool flexfec;
bool automatic_scaling;
std::string clip_name; // "Generator" to generate frames instead.
size_t capture_device_index;
} video[2];
struct Audio {
bool enabled;
bool sync_video;
bool dtx;
} audio;
struct Screenshare {
bool enabled;
bool generate_slides;
int32_t slide_change_interval;
int32_t scroll_duration;
std::vector<std::string> slides;
} screenshare[2];
struct Analyzer {
std::string test_label;
double avg_psnr_threshold; // (*)
double avg_ssim_threshold; // (*)
int test_durations_secs;
std::string graph_data_output_filename;
std::string graph_title;
} analyzer;
NetworkSimulationInterface::SimulatedNetworkConfig pipe;
struct SS { // Spatial scalability.
std::vector<VideoStream> streams; // If empty, one stream is assumed.
size_t selected_stream;
int num_spatial_layers;
int selected_sl;
InterLayerPredMode inter_layer_pred;
// If empty, bitrates are generated in VP9Impl automatically.
std::vector<SpatialLayer> spatial_layers;
// If set, default parameters will be used instead of |streams|.
bool infer_streams;
} ss[2];
struct Logging {
bool logs;
std::string rtc_event_log_name;
std::string rtp_dump_name;
std::string encoded_frame_base_path;
} logging;
};
virtual ~VideoQualityTestFixtureInterface() = default;
virtual void RunWithAnalyzer(const Params& params) = 0;
virtual void RunWithRenderers(const Params& params) = 0;
virtual const std::map<uint8_t, webrtc::MediaType>& payload_type_map() = 0;
};
} // namespace webrtc
#endif // API_TEST_VIDEO_QUALITY_TEST_FIXTURE_H_

View file

@ -51,7 +51,6 @@ rtc_source_set("call_interfaces") {
# when interfaces have stabilized. See also TODO for |mock_rtp_interfaces|.
rtc_source_set("rtp_interfaces") {
sources = [
"bitrate_constraints.h",
"rtcp_packet_sink_interface.h",
"rtp_config.cc",
"rtp_config.h",
@ -61,6 +60,7 @@ rtc_source_set("rtp_interfaces") {
]
deps = [
"../api:array_view",
"../api:libjingle_peerconnection_api",
"../api/transport:bitrate_settings",
"../rtc_base:rtc_base_approved",
"//third_party/abseil-cpp/absl/types:optional",
@ -123,6 +123,7 @@ rtc_source_set("bitrate_configurator") {
]
deps = [
":rtp_interfaces",
"../api:libjingle_peerconnection_api",
"../api/transport:bitrate_settings",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
@ -240,6 +241,7 @@ rtc_source_set("fake_network") {
":call_interfaces",
"..:typedefs",
"..:webrtc_common",
"../api:simulated_network_api",
"../api:transport_api",
"../modules:module_api",
"../rtc_base:rtc_base_approved",
@ -366,6 +368,7 @@ if (rtc_include_tests) {
]
deps = [
":rtp_interfaces",
"../api:libjingle_peerconnection_api",
"../modules/congestion_controller",
"../modules/pacing",
"../rtc_base:rate_limiter",

View file

@ -15,6 +15,7 @@
#include <string>
#include <vector>
#include "api/mediatypes.h"
#include "call/audio_receive_stream.h"
#include "call/audio_send_stream.h"
#include "call/call_config.h"
@ -30,8 +31,6 @@
namespace webrtc {
enum class MediaType { ANY, AUDIO, VIDEO, DATA };
class PacketReceiver {
public:
enum DeliveryStatus {

View file

@ -10,11 +10,11 @@
#ifndef CALL_CALL_CONFIG_H_
#define CALL_CALL_CONFIG_H_
#include "api/bitrate_constraints.h"
#include "api/fec_controller.h"
#include "api/rtcerror.h"
#include "api/transport/network_control.h"
#include "call/audio_state.h"
#include "call/bitrate_constraints.h"
#include "rtc_base/platform_file.h"
namespace webrtc {

View file

@ -20,6 +20,7 @@
#include <vector>
#include "api/call/transport.h"
#include "api/test/simulated_network.h"
#include "call/call.h"
#include "common_types.h" // NOLINT(build/include)
#include "modules/include/module.h"
@ -84,56 +85,12 @@ class NetworkPacket {
absl::optional<PacketTime> packet_time_;
};
struct PacketInFlightInfo {
PacketInFlightInfo(size_t size, int64_t send_time_us, uint64_t packet_id)
: size(size), send_time_us(send_time_us), packet_id(packet_id) {}
size_t size;
int64_t send_time_us;
// Unique identifier for the packet in relation to other packets in flight.
uint64_t packet_id;
};
struct PacketDeliveryInfo {
static constexpr int kNotReceived = -1;
PacketDeliveryInfo(PacketInFlightInfo source, int64_t receive_time_us)
: receive_time_us(receive_time_us), packet_id(source.packet_id) {}
int64_t receive_time_us;
uint64_t packet_id;
};
class NetworkSimulationInterface {
public:
virtual bool EnqueuePacket(PacketInFlightInfo packet_info) = 0;
// Retrieves all packets that should be delivered by the given receive time.
virtual std::vector<PacketDeliveryInfo> DequeueDeliverablePackets(
int64_t receive_time_us) = 0;
virtual absl::optional<int64_t> NextDeliveryTimeUs() const = 0;
virtual ~NetworkSimulationInterface() = default;
};
// Class simulating a network link. This is a simple and naive solution just
// faking capacity and adding an extra transport delay in addition to the
// capacity introduced delay.
class SimulatedNetwork : public NetworkSimulationInterface {
public:
struct Config {
Config() {}
// Queue length in number of packets.
size_t queue_length_packets = 0;
// Delay in addition to capacity induced delay.
int queue_delay_ms = 0;
// Standard deviation of the extra delay.
int delay_standard_deviation_ms = 0;
// Link capacity in kbps.
int link_capacity_kbps = 0;
// Random packet loss.
int loss_percent = 0;
// If packets are allowed to be reordered.
bool allow_reordering = false;
// The average length of a burst of lost packets.
int avg_burst_loss_length = -1;
};
using Config = NetworkSimulationInterface::SimulatedNetworkConfig;
explicit SimulatedNetwork(Config config, uint64_t random_seed = 1);
// Sets a new configuration. This won't affect packets already in the pipe.

View file

@ -11,8 +11,8 @@
#ifndef CALL_RTP_BITRATE_CONFIGURATOR_H_
#define CALL_RTP_BITRATE_CONFIGURATOR_H_
#include "api/bitrate_constraints.h"
#include "api/transport/bitrate_settings.h"
#include "call/bitrate_constraints.h"
#include "rtc_base/constructormagic.h"
namespace webrtc {

View file

@ -16,8 +16,8 @@
#include <string>
#include "absl/types/optional.h"
#include "api/bitrate_constraints.h"
#include "api/transport/bitrate_settings.h"
#include "call/bitrate_constraints.h"
namespace rtc {
struct SentPacket;

View file

@ -13,7 +13,7 @@
#include <string>
#include "call/bitrate_constraints.h"
#include "api/bitrate_constraints.h"
#include "call/rtp_transport_controller_send_interface.h"
#include "modules/congestion_controller/include/network_changed_observer.h"
#include "modules/pacing/packet_router.h"

View file

@ -22,6 +22,7 @@
#include <unordered_map>
#include <vector>
#include "api/mediatypes.h"
#include "api/candidate.h"
#include "api/cryptoparams.h"
#include "api/jsepicecandidate.h"
@ -232,7 +233,7 @@ template <class T>
static void AddFmtpLine(const T& codec, std::string* message);
static void BuildMediaDescription(const ContentInfo* content_info,
const TransportInfo* transport_info,
const MediaType media_type,
const cricket::MediaType media_type,
const std::vector<Candidate>& candidates,
int msid_signaling,
std::string* message);
@ -240,11 +241,11 @@ static void BuildSctpContentAttributes(std::string* message,
int sctp_port,
bool use_sctpmap);
static void BuildRtpContentAttributes(const MediaContentDescription* media_desc,
const MediaType media_type,
const cricket::MediaType media_type,
int msid_signaling,
std::string* message);
static void BuildRtpMap(const MediaContentDescription* media_desc,
const MediaType media_type,
const cricket::MediaType media_type,
std::string* message);
static void BuildCandidate(const std::vector<Candidate>& candidates,
bool include_ufrag,
@ -275,7 +276,7 @@ static bool ParseMediaDescription(
std::vector<JsepIceCandidate*>* candidates,
SdpParseError* error);
static bool ParseContent(const std::string& message,
const MediaType media_type,
const cricket::MediaType media_type,
int mline_index,
const std::string& protocol,
const std::vector<int>& payload_types,
@ -298,12 +299,12 @@ static bool ParseCryptoAttribute(const std::string& line,
MediaContentDescription* media_desc,
SdpParseError* error);
static bool ParseRtpmapAttribute(const std::string& line,
const MediaType media_type,
const cricket::MediaType media_type,
const std::vector<int>& payload_types,
MediaContentDescription* media_desc,
SdpParseError* error);
static bool ParseFmtpAttributes(const std::string& line,
const MediaType media_type,
const cricket::MediaType media_type,
MediaContentDescription* media_desc,
SdpParseError* error);
static bool ParseFmtpParam(const std::string& line,
@ -315,7 +316,7 @@ static bool ParseCandidate(const std::string& message,
SdpParseError* error,
bool is_raw);
static bool ParseRtcpFbAttribute(const std::string& line,
const MediaType media_type,
const cricket::MediaType media_type,
MediaContentDescription* media_desc,
SdpParseError* error);
static bool ParseIceOptions(const std::string& line,
@ -1243,7 +1244,7 @@ bool ParseExtmap(const std::string& line,
void BuildMediaDescription(const ContentInfo* content_info,
const TransportInfo* transport_info,
const MediaType media_type,
const cricket::MediaType media_type,
const std::vector<Candidate>& candidates,
int msid_signaling,
std::string* message) {
@ -1477,7 +1478,7 @@ void BuildSctpContentAttributes(std::string* message,
}
void BuildRtpContentAttributes(const MediaContentDescription* media_desc,
const MediaType media_type,
const cricket::MediaType media_type,
int msid_signaling,
std::string* message) {
std::ostringstream os;
@ -1767,7 +1768,7 @@ bool GetParameter(const std::string& name,
}
void BuildRtpMap(const MediaContentDescription* media_desc,
const MediaType media_type,
const cricket::MediaType media_type,
std::string* message) {
RTC_DCHECK(message != NULL);
RTC_DCHECK(media_desc != NULL);
@ -2328,7 +2329,7 @@ void MaybeCreateStaticPayloadAudioCodecs(const std::vector<int>& fmts,
template <class C>
static C* ParseContentDescription(const std::string& message,
const MediaType media_type,
const cricket::MediaType media_type,
int mline_index,
const std::string& protocol,
const std::vector<int>& payload_types,
@ -2709,7 +2710,7 @@ void AddAudioAttribute(const std::string& name,
}
bool ParseContent(const std::string& message,
const MediaType media_type,
const cricket::MediaType media_type,
int mline_index,
const std::string& protocol,
const std::vector<int>& payload_types,
@ -3198,7 +3199,7 @@ void UpdateCodec(int payload_type,
}
bool ParseRtpmapAttribute(const std::string& line,
const MediaType media_type,
const cricket::MediaType media_type,
const std::vector<int>& payload_types,
MediaContentDescription* media_desc,
SdpParseError* error) {
@ -3281,7 +3282,7 @@ bool ParseFmtpParam(const std::string& line,
}
bool ParseFmtpAttributes(const std::string& line,
const MediaType media_type,
const cricket::MediaType media_type,
MediaContentDescription* media_desc,
SdpParseError* error) {
if (media_type != cricket::MEDIA_TYPE_AUDIO &&
@ -3345,7 +3346,7 @@ bool ParseFmtpAttributes(const std::string& line,
}
bool ParseRtcpFbAttribute(const std::string& line,
const MediaType media_type,
const cricket::MediaType media_type,
MediaContentDescription* media_desc,
SdpParseError* error) {
if (media_type != cricket::MEDIA_TYPE_AUDIO &&

View file

@ -146,12 +146,20 @@ if (rtc_include_tests) {
}
rtc_source_set("video_quality_test") {
testonly = true
visibility = [ ":*" ] # Only targets in this file can depend on this.
# Only targets in this file and api/ can depend on this.
visibility = [
":*",
"../api:create_video_quality_test_fixture_api",
]
sources = [
"video_quality_test.cc",
"video_quality_test.h",
]
deps = [
"../api:fec_controller_api",
"../api:video_quality_test_fixture_api",
"../call:fake_network",
"../logging:rtc_event_log_api",
"../logging:rtc_event_log_impl_output",
"../media:rtc_audio_video",

File diff suppressed because it is too large Load diff

View file

@ -333,11 +333,11 @@ void Loopback() {
flags::SelectedStream(), flags::NumSpatialLayers(), flags::SelectedSL(),
flags::InterLayerPred(), SL_descriptors);
VideoQualityTest test;
auto fixture = rtc::MakeUnique<VideoQualityTest>(nullptr);
if (flags::DurationSecs()) {
test.RunWithAnalyzer(params);
fixture->RunWithAnalyzer(params);
} else {
test.RunWithRenderers(params);
fixture->RunWithRenderers(params);
}
}
} // namespace webrtc

View file

@ -578,11 +578,11 @@ void Loopback() {
flags::VideoSelectedStream(), flags::VideoNumSpatialLayers(),
flags::VideoSelectedSL(), flags::VideoInterLayerPred(), SL_descriptors);
VideoQualityTest test;
auto fixture = rtc::MakeUnique<VideoQualityTest>(nullptr);
if (flags::DurationSecs()) {
test.RunWithAnalyzer(params);
fixture->RunWithAnalyzer(params);
} else {
test.RunWithRenderers(params);
fixture->RunWithRenderers(params);
}
}
} // namespace webrtc

View file

@ -334,11 +334,11 @@ void Loopback() {
flags::SelectedStream(), flags::NumSpatialLayers(), flags::SelectedSL(),
flags::InterLayerPred(), SL_descriptors);
VideoQualityTest test;
auto fixture = rtc::MakeUnique<VideoQualityTest>(nullptr);
if (flags::DurationSecs()) {
test.RunWithAnalyzer(params);
fixture->RunWithAnalyzer(params);
} else {
test.RunWithRenderers(params);
fixture->RunWithRenderers(params);
}
}
} // namespace webrtc

View file

@ -1089,7 +1089,8 @@ VideoQualityTest::TestVideoEncoderFactory::CreateVideoEncoder(
}
}
VideoQualityTest::VideoQualityTest()
VideoQualityTest::VideoQualityTest(
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory)
: clock_(Clock::GetRealTimeClock()), receive_logs_(0), send_logs_(0) {
payload_type_map_ = test::CallTest::payload_type_map_;
RTC_DCHECK(payload_type_map_.find(kPayloadTypeH264) ==
@ -1101,11 +1102,7 @@ VideoQualityTest::VideoQualityTest()
payload_type_map_[kPayloadTypeH264] = webrtc::MediaType::VIDEO;
payload_type_map_[kPayloadTypeVP8] = webrtc::MediaType::VIDEO;
payload_type_map_[kPayloadTypeVP9] = webrtc::MediaType::VIDEO;
}
VideoQualityTest::VideoQualityTest(
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory)
: VideoQualityTest() {
fec_controller_factory_ = std::move(fec_controller_factory);
}

View file

@ -15,6 +15,9 @@
#include <string>
#include <vector>
#include "api/fec_controller.h"
#include "api/test/video_quality_test_fixture.h"
#include "call/fake_network_pipe.h"
#include "media/engine/internalencoderfactory.h"
#include "test/call_test.h"
#include "test/frame_generator.h"
@ -22,86 +25,18 @@
namespace webrtc {
class VideoQualityTest : public test::CallTest {
class VideoQualityTest :
public test::CallTest, public VideoQualityTestFixtureInterface {
public:
// Parameters are grouped into smaller structs to make it easier to set
// the desired elements and skip unused, using aggregate initialization.
// Unfortunately, C++11 (as opposed to C11) doesn't support unnamed structs,
// which makes the implementation of VideoQualityTest a bit uglier.
struct Params {
Params();
~Params();
struct CallConfig {
bool send_side_bwe;
BitrateConstraints call_bitrate_config;
int num_thumbnails;
// Indicates if secondary_(video|ss|screenshare) structures are used.
bool dual_video;
} call;
struct Video {
bool enabled;
size_t width;
size_t height;
int32_t fps;
int min_bitrate_bps;
int target_bitrate_bps;
int max_bitrate_bps;
bool suspend_below_min_bitrate;
std::string codec;
int num_temporal_layers;
int selected_tl;
int min_transmit_bps;
bool ulpfec;
bool flexfec;
bool automatic_scaling;
std::string clip_name; // "Generator" to generate frames instead.
size_t capture_device_index;
} video[2];
struct Audio {
bool enabled;
bool sync_video;
bool dtx;
} audio;
struct Screenshare {
bool enabled;
bool generate_slides;
int32_t slide_change_interval;
int32_t scroll_duration;
std::vector<std::string> slides;
} screenshare[2];
struct Analyzer {
std::string test_label;
double avg_psnr_threshold; // (*)
double avg_ssim_threshold; // (*)
int test_durations_secs;
std::string graph_data_output_filename;
std::string graph_title;
} analyzer;
FakeNetworkPipe::Config pipe;
struct SS { // Spatial scalability.
std::vector<VideoStream> streams; // If empty, one stream is assumed.
size_t selected_stream;
int num_spatial_layers;
int selected_sl;
InterLayerPredMode inter_layer_pred;
// If empty, bitrates are generated in VP9Impl automatically.
std::vector<SpatialLayer> spatial_layers;
// If set, default parameters will be used instead of |streams|.
bool infer_streams;
} ss[2];
struct Logging {
bool logs;
std::string rtc_event_log_name;
std::string rtp_dump_name;
std::string encoded_frame_base_path;
} logging;
};
VideoQualityTest();
explicit VideoQualityTest(
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory);
void RunWithAnalyzer(const Params& params);
void RunWithRenderers(const Params& params);
void RunWithAnalyzer(const Params& params) override;
void RunWithRenderers(const Params& params) override;
const std::map<uint8_t, webrtc::MediaType>& payload_type_map() override {
return payload_type_map_;
}
static void FillScalabilitySettings(
Params* params,
@ -114,6 +49,11 @@ class VideoQualityTest : public test::CallTest {
InterLayerPredMode inter_layer_pred,
const std::vector<std::string>& sl_descriptors);
// Helper static methods.
static VideoStream DefaultVideoStream(const Params& params, size_t video_idx);
static VideoStream DefaultThumbnailStream();
static std::vector<int> ParseCSV(const std::string& str);
protected:
class TestVideoEncoderFactory : public VideoEncoderFactory {
std::vector<SdpVideoFormat> GetSupportedFormats() const override;
@ -138,11 +78,6 @@ class VideoQualityTest : public test::CallTest {
std::string GenerateGraphTitle() const;
void CheckParams();
// Helper static methods.
static VideoStream DefaultVideoStream(const Params& params, size_t video_idx);
static VideoStream DefaultThumbnailStream();
static std::vector<int> ParseCSV(const std::string& str);
// Helper methods for setting up the call.
void CreateVideoStreams();
void DestroyStreams();