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