blob: bf7fed62aed6f23b529d774d5d92c5c5f27c1392 [file] [log] [blame]
Patrik Höglundb6b29e02018-06-21 16:58:01 +02001/*
2 * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef API_TEST_VIDEO_QUALITY_TEST_FIXTURE_H_
12#define API_TEST_VIDEO_QUALITY_TEST_FIXTURE_H_
13
14#include <map>
15#include <memory>
16#include <string>
17#include <vector>
18
19#include "api/bitrate_constraints.h"
Patrik Höglundd8f3c172018-09-26 14:39:17 +020020#include "api/fec_controller.h"
Patrik Höglundb6b29e02018-06-21 16:58:01 +020021#include "api/mediatypes.h"
22#include "api/test/simulated_network.h"
23#include "api/video_codecs/video_encoder_config.h"
24
25namespace webrtc {
26
27class VideoQualityTestFixtureInterface {
28 public:
29 // Parameters are grouped into smaller structs to make it easier to set
30 // the desired elements and skip unused, using aggregate initialization.
31 // Unfortunately, C++11 (as opposed to C11) doesn't support unnamed structs,
32 // which makes the implementation of VideoQualityTest a bit uglier.
33 struct Params {
34 Params();
35 ~Params();
36 struct CallConfig {
37 bool send_side_bwe;
philipel569397f2018-09-26 12:25:31 +020038 bool generic_descriptor;
Patrik Höglundb6b29e02018-06-21 16:58:01 +020039 BitrateConstraints call_bitrate_config;
40 int num_thumbnails;
41 // Indicates if secondary_(video|ss|screenshare) structures are used.
42 bool dual_video;
43 } call;
44 struct Video {
45 bool enabled;
46 size_t width;
47 size_t height;
48 int32_t fps;
49 int min_bitrate_bps;
50 int target_bitrate_bps;
51 int max_bitrate_bps;
52 bool suspend_below_min_bitrate;
53 std::string codec;
54 int num_temporal_layers;
55 int selected_tl;
56 int min_transmit_bps;
57 bool ulpfec;
58 bool flexfec;
59 bool automatic_scaling;
60 std::string clip_name; // "Generator" to generate frames instead.
61 size_t capture_device_index;
Emircan Uysaler0823eec2018-07-13 17:10:00 -070062 SdpVideoFormat::Parameters sdp_params;
Patrik Höglundb6b29e02018-06-21 16:58:01 +020063 } video[2];
64 struct Audio {
65 bool enabled;
66 bool sync_video;
67 bool dtx;
henrika255750b2018-08-27 16:13:37 +020068 bool use_real_adm;
Patrik Höglundb6b29e02018-06-21 16:58:01 +020069 } audio;
70 struct Screenshare {
71 bool enabled;
72 bool generate_slides;
73 int32_t slide_change_interval;
74 int32_t scroll_duration;
75 std::vector<std::string> slides;
76 } screenshare[2];
77 struct Analyzer {
78 std::string test_label;
79 double avg_psnr_threshold; // (*)
80 double avg_ssim_threshold; // (*)
81 int test_durations_secs;
82 std::string graph_data_output_filename;
83 std::string graph_title;
84 } analyzer;
Artem Titovf18b3522018-08-28 16:54:24 +020085 // Deprecated. DO NOT USE. Use config instead. This is not pipe actually,
86 // it is just configuration, that will be passed to default implementation
87 // of simulation layer.
Artem Titov75e36472018-10-08 12:28:56 +020088 BuiltInNetworkBehaviorConfig pipe;
Artem Titove269cb42018-08-29 09:59:23 +020089 // Config for default simulation implementation. Must be nullopt if
90 // `sender_network` and `receiver_network` in InjectionComponents are
91 // non-null. May be nullopt even if `sender_network` and `receiver_network`
92 // are null; in that case, a default config will be used.
Artem Titov75e36472018-10-08 12:28:56 +020093 absl::optional<BuiltInNetworkBehaviorConfig> config;
Patrik Höglundb6b29e02018-06-21 16:58:01 +020094 struct SS { // Spatial scalability.
95 std::vector<VideoStream> streams; // If empty, one stream is assumed.
96 size_t selected_stream;
97 int num_spatial_layers;
98 int selected_sl;
99 InterLayerPredMode inter_layer_pred;
100 // If empty, bitrates are generated in VP9Impl automatically.
101 std::vector<SpatialLayer> spatial_layers;
102 // If set, default parameters will be used instead of |streams|.
103 bool infer_streams;
104 } ss[2];
105 struct Logging {
Patrik Höglundb6b29e02018-06-21 16:58:01 +0200106 std::string rtc_event_log_name;
107 std::string rtp_dump_name;
108 std::string encoded_frame_base_path;
109 } logging;
110 };
111
Artem Titove269cb42018-08-29 09:59:23 +0200112 // Contains objects, that will be injected on different layers of test
113 // framework to override the behavior of system parts.
114 struct InjectionComponents {
115 InjectionComponents();
116 ~InjectionComponents();
117
118 // Simulations of sender and receiver networks. They must either both be
119 // null (in which case `config` from Params is used), or both be non-null
120 // (in which case `config` from Params must be nullopt).
Artem Titov8ea1e9d2018-10-04 14:46:31 +0200121 std::unique_ptr<NetworkBehaviorInterface> sender_network;
122 std::unique_ptr<NetworkBehaviorInterface> receiver_network;
Artem Titove269cb42018-08-29 09:59:23 +0200123
124 std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory;
125 };
126
Patrik Höglundb6b29e02018-06-21 16:58:01 +0200127 virtual ~VideoQualityTestFixtureInterface() = default;
128
129 virtual void RunWithAnalyzer(const Params& params) = 0;
130 virtual void RunWithRenderers(const Params& params) = 0;
131
132 virtual const std::map<uint8_t, webrtc::MediaType>& payload_type_map() = 0;
133};
134
135} // namespace webrtc
136
137#endif // API_TEST_VIDEO_QUALITY_TEST_FIXTURE_H_