OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2015 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 #include "gflags/gflags.h" |
| 12 #include "webrtc/test/field_trial.h" |
| 13 #include "webrtc/test/run_test.h" |
| 14 #include "webrtc/video/full_stack.h" |
| 15 |
| 16 namespace webrtc { |
| 17 namespace flags { |
| 18 |
| 19 DEFINE_string(title, "Full stack graph", "Graph title."); |
| 20 std::string Title() { |
| 21 return static_cast<std::string>(FLAGS_title); |
| 22 } |
| 23 |
| 24 DEFINE_string(filename, "graph_data.txt", "Name of a target graph data file."); |
| 25 std::string Filename() { |
| 26 return static_cast<std::string>(FLAGS_filename); |
| 27 } |
| 28 |
| 29 DEFINE_string(clip_name, "screenshare_slides", "Clip name, resource name."); |
| 30 std::string ClipName() { |
| 31 return static_cast<std::string>(FLAGS_clip_name); |
| 32 } |
| 33 |
| 34 DEFINE_int32(width, 1850, "Video width (crops source)."); |
| 35 size_t Width() { |
| 36 return static_cast<size_t>(FLAGS_width); |
| 37 } |
| 38 |
| 39 DEFINE_int32(height, 1110, "Video height (crops source)."); |
| 40 size_t Height() { |
| 41 return static_cast<size_t>(FLAGS_height); |
| 42 } |
| 43 |
| 44 DEFINE_int32(fps, 5, "Frames per second."); |
| 45 int Fps() { |
| 46 return static_cast<int>(FLAGS_fps); |
| 47 } |
| 48 |
| 49 DEFINE_int32( |
| 50 content_mode, |
| 51 1, |
| 52 "0 - real time video, 1 - screenshare static, 2 - screenshare scrolling."); |
| 53 ContentMode ContentModeFlag() { |
| 54 switch (FLAGS_content_mode) { |
| 55 case 0: |
| 56 return ContentMode::kRealTimeVideo; |
| 57 case 1: |
| 58 return ContentMode::kScreensharingStaticImage; |
| 59 case 2: |
| 60 return ContentMode::kScreensharingScrollingImage; |
| 61 default: |
| 62 RTC_NOTREACHED() << "Unknown content mode!"; |
| 63 return ContentMode::kScreensharingStaticImage; |
| 64 } |
| 65 } |
| 66 |
| 67 DEFINE_int32(test_duration, 60, "Duration of the test in seconds."); |
| 68 int TestDuration() { |
| 69 return static_cast<int>(FLAGS_test_duration); |
| 70 } |
| 71 |
| 72 DEFINE_int32(min_bitrate, 50000, "Minimum video bitrate."); |
| 73 int MinBitrate() { |
| 74 return static_cast<int>(FLAGS_min_bitrate); |
| 75 } |
| 76 |
| 77 DEFINE_int32(target_bitrate, |
| 78 500000, |
| 79 "Target video bitrate. (Default value here different than in full " |
| 80 "stack tests!)"); |
| 81 int TargetBitrate() { |
| 82 return static_cast<int>(FLAGS_target_bitrate); |
| 83 } |
| 84 |
| 85 DEFINE_int32(max_bitrate, |
| 86 500000, |
| 87 "Maximum video bitrate. (Default value here different than in " |
| 88 "full stack tests!)"); |
| 89 int MaxBitrate() { |
| 90 return static_cast<int>(FLAGS_max_bitrate); |
| 91 } |
| 92 |
| 93 DEFINE_string(codec, "VP9", "Video codec to use."); |
| 94 std::string Codec() { |
| 95 return static_cast<std::string>(FLAGS_codec); |
| 96 } |
| 97 |
| 98 DEFINE_string( |
| 99 force_fieldtrials, |
| 100 "", |
| 101 "Field trials control experimental feature code which can be forced. " |
| 102 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" |
| 103 " will assign the group Enable to field trial WebRTC-FooFeature. Multiple " |
| 104 "trials are separated by \"/\""); |
| 105 } // namespace flags |
| 106 |
| 107 class FullStackGenGraph : public FullStackTest { |
| 108 public: |
| 109 void TestBody() override { |
| 110 std::string title = flags::Title(); |
| 111 std::string clip_name = flags::ClipName(); |
| 112 FullStackTestParams params = { |
| 113 title.c_str(), |
| 114 {clip_name.c_str(), flags::Width(), flags::Height(), flags::Fps()}, |
| 115 flags::ContentModeFlag(), |
| 116 flags::MinBitrate(), |
| 117 flags::TargetBitrate(), |
| 118 flags::MaxBitrate(), |
| 119 0.0, // avg_psnr_threshold |
| 120 0.0, // avg_ssim_threshold |
| 121 flags::TestDuration(), |
| 122 flags::Codec()}; |
| 123 params.graph_data_output_filename = flags::Filename(); |
| 124 |
| 125 RunTest(params); |
| 126 } |
| 127 }; |
| 128 |
| 129 void FullStackRun(void) { |
| 130 FullStackGenGraph full_stack; |
| 131 full_stack.TestBody(); |
| 132 } |
| 133 } // namespace webrtc |
| 134 |
| 135 int main(int argc, char* argv[]) { |
| 136 ::testing::InitGoogleTest(&argc, argv); |
| 137 google::ParseCommandLineFlags(&argc, &argv, true); |
| 138 webrtc::test::InitFieldTrialsFromString( |
| 139 webrtc::flags::FLAGS_force_fieldtrials); |
| 140 webrtc::test::RunTest(webrtc::FullStackRun); |
| 141 return 0; |
| 142 } |
OLD | NEW |