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(is_screenshare, 1, "Is screenshare?"); |
| 50 int IsScreenshare() { |
| 51 return static_cast<int>(FLAGS_is_screenshare); |
| 52 } |
| 53 |
| 54 DEFINE_int32(test_duration, 60, "Duration of the test in seconds."); |
| 55 int TestDuration() { |
| 56 return static_cast<int>(FLAGS_test_duration); |
| 57 } |
| 58 |
| 59 DEFINE_int32(min_bitrate, 50000, "Minimum video bitrate."); |
| 60 int MinBitrate() { |
| 61 return static_cast<int>(FLAGS_min_bitrate); |
| 62 } |
| 63 |
| 64 DEFINE_int32(target_bitrate, |
| 65 500000, |
| 66 "Target video bitrate. (Default value here different than in full " |
| 67 "stack tests!)"); |
| 68 int TargetBitrate() { |
| 69 return static_cast<int>(FLAGS_target_bitrate); |
| 70 } |
| 71 |
| 72 DEFINE_int32(max_bitrate, |
| 73 500000, |
| 74 "Maximum video bitrate. (Default value here different than in " |
| 75 "full stack tests!)"); |
| 76 int MaxBitrate() { |
| 77 return static_cast<int>(FLAGS_max_bitrate); |
| 78 } |
| 79 |
| 80 DEFINE_string(codec, "VP9", "Video codec to use."); |
| 81 std::string Codec() { |
| 82 return static_cast<std::string>(FLAGS_codec); |
| 83 } |
| 84 |
| 85 DEFINE_string( |
| 86 force_fieldtrials, |
| 87 "", |
| 88 "Field trials control experimental feature code which can be forced. " |
| 89 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" |
| 90 " will assign the group Enable to field trial WebRTC-FooFeature. Multiple " |
| 91 "trials are separated by \"/\""); |
| 92 } // namespace flags |
| 93 |
| 94 class FullStackGenGraph : public FullStackTest { |
| 95 public: |
| 96 void TestBody() override { |
| 97 std::string title = flags::Title(); |
| 98 std::string clip_name = flags::ClipName(); |
| 99 FullStackTestParams params = { |
| 100 title.c_str(), |
| 101 {clip_name.c_str(), flags::Width(), flags::Height(), flags::Fps()}, |
| 102 flags::IsScreenshare(), |
| 103 flags::MinBitrate(), |
| 104 flags::TargetBitrate(), |
| 105 flags::MaxBitrate(), |
| 106 0.0, |
| 107 0.0, |
| 108 flags::TestDuration(), |
| 109 flags::Codec()}; |
| 110 params.graph_data_filename = flags::Filename(); |
| 111 |
| 112 RunTest(params); |
| 113 } |
| 114 }; |
| 115 |
| 116 void FullStackRun(void) { |
| 117 FullStackGenGraph full_stack; |
| 118 full_stack.TestBody(); |
| 119 } |
| 120 } // namespace webrtc |
| 121 |
| 122 int main(int argc, char* argv[]) { |
| 123 ::testing::InitGoogleTest(&argc, argv); |
| 124 google::ParseCommandLineFlags(&argc, &argv, true); |
| 125 webrtc::test::InitFieldTrialsFromString( |
| 126 webrtc::flags::FLAGS_force_fieldtrials); |
| 127 webrtc::test::RunTest(webrtc::FullStackRun); |
| 128 return 0; |
| 129 } |
OLD | NEW |