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; |
| 37 | BitrateConstraints call_bitrate_config; |
| 38 | int num_thumbnails; |
| 39 | // Indicates if secondary_(video|ss|screenshare) structures are used. |
| 40 | bool dual_video; |
| 41 | } call; |
| 42 | struct Video { |
| 43 | bool enabled; |
| 44 | size_t width; |
| 45 | size_t height; |
| 46 | int32_t fps; |
| 47 | int min_bitrate_bps; |
| 48 | int target_bitrate_bps; |
| 49 | int max_bitrate_bps; |
| 50 | bool suspend_below_min_bitrate; |
| 51 | std::string codec; |
| 52 | int num_temporal_layers; |
| 53 | int selected_tl; |
| 54 | int min_transmit_bps; |
| 55 | bool ulpfec; |
| 56 | bool flexfec; |
| 57 | bool automatic_scaling; |
| 58 | std::string clip_name; // "Generator" to generate frames instead. |
| 59 | size_t capture_device_index; |
| 60 | } video[2]; |
| 61 | struct Audio { |
| 62 | bool enabled; |
| 63 | bool sync_video; |
| 64 | bool dtx; |
| 65 | } audio; |
| 66 | struct Screenshare { |
| 67 | bool enabled; |
| 68 | bool generate_slides; |
| 69 | int32_t slide_change_interval; |
| 70 | int32_t scroll_duration; |
| 71 | std::vector<std::string> slides; |
| 72 | } screenshare[2]; |
| 73 | struct Analyzer { |
| 74 | std::string test_label; |
| 75 | double avg_psnr_threshold; // (*) |
| 76 | double avg_ssim_threshold; // (*) |
| 77 | int test_durations_secs; |
| 78 | std::string graph_data_output_filename; |
| 79 | std::string graph_title; |
| 80 | } analyzer; |
| 81 | NetworkSimulationInterface::SimulatedNetworkConfig pipe; |
| 82 | struct SS { // Spatial scalability. |
| 83 | std::vector<VideoStream> streams; // If empty, one stream is assumed. |
| 84 | size_t selected_stream; |
| 85 | int num_spatial_layers; |
| 86 | int selected_sl; |
| 87 | InterLayerPredMode inter_layer_pred; |
| 88 | // If empty, bitrates are generated in VP9Impl automatically. |
| 89 | std::vector<SpatialLayer> spatial_layers; |
| 90 | // If set, default parameters will be used instead of |streams|. |
| 91 | bool infer_streams; |
| 92 | } ss[2]; |
| 93 | struct Logging { |
| 94 | bool logs; |
| 95 | std::string rtc_event_log_name; |
| 96 | std::string rtp_dump_name; |
| 97 | std::string encoded_frame_base_path; |
| 98 | } logging; |
| 99 | }; |
| 100 | |
| 101 | virtual ~VideoQualityTestFixtureInterface() = default; |
| 102 | |
| 103 | virtual void RunWithAnalyzer(const Params& params) = 0; |
| 104 | virtual void RunWithRenderers(const Params& params) = 0; |
| 105 | |
| 106 | virtual const std::map<uint8_t, webrtc::MediaType>& payload_type_map() = 0; |
| 107 | }; |
| 108 | |
| 109 | } // namespace webrtc |
| 110 | |
| 111 | #endif // API_TEST_VIDEO_QUALITY_TEST_FIXTURE_H_ |