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