Patrik Höglund | b6b29e0 | 2018-06-21 16:58:01 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
Patrik Höglund | d8f3c17 | 2018-09-26 14:39:17 +0200 | [diff] [blame] | 19 | #include "api/fec_controller.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 20 | #include "api/media_types.h" |
Ying Wang | cab77fd | 2019-04-16 11:12:49 +0200 | [diff] [blame] | 21 | #include "api/network_state_predictor.h" |
Patrik Höglund | b6b29e0 | 2018-06-21 16:58:01 +0200 | [diff] [blame] | 22 | #include "api/test/simulated_network.h" |
Mirko Bonadei | 738bfa7 | 2019-09-17 14:47:38 +0200 | [diff] [blame] | 23 | #include "api/transport/bitrate_settings.h" |
Sebastian Jansson | 1391ed2 | 2019-04-30 14:23:51 +0200 | [diff] [blame] | 24 | #include "api/transport/network_control.h" |
“Michael | 3c396e5 | 2019-06-12 09:47:14 -0500 | [diff] [blame] | 25 | #include "api/video_codecs/video_decoder_factory.h" |
Patrik Höglund | b6b29e0 | 2018-06-21 16:58:01 +0200 | [diff] [blame] | 26 | #include "api/video_codecs/video_encoder_config.h" |
“Michael | 3c396e5 | 2019-06-12 09:47:14 -0500 | [diff] [blame] | 27 | #include "api/video_codecs/video_encoder_factory.h" |
Patrik Höglund | b6b29e0 | 2018-06-21 16:58:01 +0200 | [diff] [blame] | 28 | |
| 29 | namespace webrtc { |
| 30 | |
| 31 | class VideoQualityTestFixtureInterface { |
| 32 | public: |
| 33 | // Parameters are grouped into smaller structs to make it easier to set |
| 34 | // the desired elements and skip unused, using aggregate initialization. |
| 35 | // Unfortunately, C++11 (as opposed to C11) doesn't support unnamed structs, |
| 36 | // which makes the implementation of VideoQualityTest a bit uglier. |
| 37 | struct Params { |
| 38 | Params(); |
| 39 | ~Params(); |
| 40 | struct CallConfig { |
| 41 | bool send_side_bwe; |
philipel | 569397f | 2018-09-26 12:25:31 +0200 | [diff] [blame] | 42 | bool generic_descriptor; |
Patrik Höglund | b6b29e0 | 2018-06-21 16:58:01 +0200 | [diff] [blame] | 43 | BitrateConstraints call_bitrate_config; |
| 44 | int num_thumbnails; |
| 45 | // Indicates if secondary_(video|ss|screenshare) structures are used. |
| 46 | bool dual_video; |
| 47 | } call; |
| 48 | struct Video { |
| 49 | bool enabled; |
| 50 | size_t width; |
| 51 | size_t height; |
| 52 | int32_t fps; |
| 53 | int min_bitrate_bps; |
| 54 | int target_bitrate_bps; |
| 55 | int max_bitrate_bps; |
| 56 | bool suspend_below_min_bitrate; |
| 57 | std::string codec; |
| 58 | int num_temporal_layers; |
| 59 | int selected_tl; |
| 60 | int min_transmit_bps; |
| 61 | bool ulpfec; |
| 62 | bool flexfec; |
| 63 | bool automatic_scaling; |
Rasmus Brandt | 3c589be | 2019-03-13 11:32:40 +0100 | [diff] [blame] | 64 | std::string clip_path; // "Generator" to generate frames instead. |
Patrik Höglund | b6b29e0 | 2018-06-21 16:58:01 +0200 | [diff] [blame] | 65 | size_t capture_device_index; |
Emircan Uysaler | 0823eec | 2018-07-13 17:10:00 -0700 | [diff] [blame] | 66 | SdpVideoFormat::Parameters sdp_params; |
Erik Språng | 616b233 | 2019-02-11 14:16:28 +0100 | [diff] [blame] | 67 | double encoder_overshoot_factor; |
Patrik Höglund | b6b29e0 | 2018-06-21 16:58:01 +0200 | [diff] [blame] | 68 | } video[2]; |
| 69 | struct Audio { |
| 70 | bool enabled; |
| 71 | bool sync_video; |
| 72 | bool dtx; |
henrika | 255750b | 2018-08-27 16:13:37 +0200 | [diff] [blame] | 73 | bool use_real_adm; |
Minyue Li | 455d27c | 2019-01-07 13:14:30 +0100 | [diff] [blame] | 74 | absl::optional<std::string> ana_config; |
Patrik Höglund | b6b29e0 | 2018-06-21 16:58:01 +0200 | [diff] [blame] | 75 | } audio; |
| 76 | struct Screenshare { |
| 77 | bool enabled; |
| 78 | bool generate_slides; |
| 79 | int32_t slide_change_interval; |
| 80 | int32_t scroll_duration; |
| 81 | std::vector<std::string> slides; |
| 82 | } screenshare[2]; |
| 83 | struct Analyzer { |
| 84 | std::string test_label; |
| 85 | double avg_psnr_threshold; // (*) |
| 86 | double avg_ssim_threshold; // (*) |
| 87 | int test_durations_secs; |
| 88 | std::string graph_data_output_filename; |
| 89 | std::string graph_title; |
| 90 | } analyzer; |
Artem Titov | e269cb4 | 2018-08-29 09:59:23 +0200 | [diff] [blame] | 91 | // Config for default simulation implementation. Must be nullopt if |
| 92 | // `sender_network` and `receiver_network` in InjectionComponents are |
| 93 | // non-null. May be nullopt even if `sender_network` and `receiver_network` |
| 94 | // are null; in that case, a default config will be used. |
Artem Titov | 75e3647 | 2018-10-08 12:28:56 +0200 | [diff] [blame] | 95 | absl::optional<BuiltInNetworkBehaviorConfig> config; |
Patrik Höglund | b6b29e0 | 2018-06-21 16:58:01 +0200 | [diff] [blame] | 96 | struct SS { // Spatial scalability. |
| 97 | std::vector<VideoStream> streams; // If empty, one stream is assumed. |
| 98 | size_t selected_stream; |
| 99 | int num_spatial_layers; |
| 100 | int selected_sl; |
| 101 | InterLayerPredMode inter_layer_pred; |
| 102 | // If empty, bitrates are generated in VP9Impl automatically. |
| 103 | std::vector<SpatialLayer> spatial_layers; |
| 104 | // If set, default parameters will be used instead of |streams|. |
| 105 | bool infer_streams; |
| 106 | } ss[2]; |
| 107 | struct Logging { |
Patrik Höglund | b6b29e0 | 2018-06-21 16:58:01 +0200 | [diff] [blame] | 108 | std::string rtc_event_log_name; |
| 109 | std::string rtp_dump_name; |
| 110 | std::string encoded_frame_base_path; |
| 111 | } logging; |
| 112 | }; |
| 113 | |
Artem Titov | e269cb4 | 2018-08-29 09:59:23 +0200 | [diff] [blame] | 114 | // Contains objects, that will be injected on different layers of test |
| 115 | // framework to override the behavior of system parts. |
| 116 | struct InjectionComponents { |
| 117 | InjectionComponents(); |
| 118 | ~InjectionComponents(); |
| 119 | |
| 120 | // Simulations of sender and receiver networks. They must either both be |
| 121 | // null (in which case `config` from Params is used), or both be non-null |
| 122 | // (in which case `config` from Params must be nullopt). |
Artem Titov | 8ea1e9d | 2018-10-04 14:46:31 +0200 | [diff] [blame] | 123 | std::unique_ptr<NetworkBehaviorInterface> sender_network; |
| 124 | std::unique_ptr<NetworkBehaviorInterface> receiver_network; |
Artem Titov | e269cb4 | 2018-08-29 09:59:23 +0200 | [diff] [blame] | 125 | |
| 126 | std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory; |
“Michael | 3c396e5 | 2019-06-12 09:47:14 -0500 | [diff] [blame] | 127 | std::unique_ptr<VideoEncoderFactory> video_encoder_factory; |
| 128 | std::unique_ptr<VideoDecoderFactory> video_decoder_factory; |
Ying Wang | cab77fd | 2019-04-16 11:12:49 +0200 | [diff] [blame] | 129 | std::unique_ptr<NetworkStatePredictorFactoryInterface> |
| 130 | network_state_predictor_factory; |
Sebastian Jansson | 1391ed2 | 2019-04-30 14:23:51 +0200 | [diff] [blame] | 131 | std::unique_ptr<NetworkControllerFactoryInterface> |
| 132 | network_controller_factory; |
Artem Titov | e269cb4 | 2018-08-29 09:59:23 +0200 | [diff] [blame] | 133 | }; |
| 134 | |
Patrik Höglund | b6b29e0 | 2018-06-21 16:58:01 +0200 | [diff] [blame] | 135 | virtual ~VideoQualityTestFixtureInterface() = default; |
| 136 | |
| 137 | virtual void RunWithAnalyzer(const Params& params) = 0; |
| 138 | virtual void RunWithRenderers(const Params& params) = 0; |
| 139 | |
| 140 | virtual const std::map<uint8_t, webrtc::MediaType>& payload_type_map() = 0; |
| 141 | }; |
| 142 | |
| 143 | } // namespace webrtc |
| 144 | |
| 145 | #endif // API_TEST_VIDEO_QUALITY_TEST_FIXTURE_H_ |