OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include <stdio.h> | 11 #include <stdio.h> |
12 | 12 |
13 #include <iostream> | 13 #include <iostream> |
14 | 14 |
15 #include "gflags/gflags.h" | 15 #include "gflags/gflags.h" |
16 #include "webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.h" | 16 #include "webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.h" |
| 17 #include "webrtc/test/testsupport/fileutils.h" |
17 #include "webrtc/typedefs.h" | 18 #include "webrtc/typedefs.h" |
18 | 19 |
19 // Flag validators. | 20 // Flag validators. |
20 static bool ValidateRuntime(const char* flagname, int value) { | 21 static bool ValidateRuntime(const char* flagname, int value) { |
21 if (value > 0) // Value is ok. | 22 if (value > 0) // Value is ok. |
22 return true; | 23 return true; |
23 printf("Invalid value for --%s: %d\n", flagname, static_cast<int>(value)); | 24 printf("Invalid value for --%s: %d\n", flagname, static_cast<int>(value)); |
24 return false; | 25 return false; |
25 } | 26 } |
26 static bool ValidateLossrate(const char* flagname, int value) { | 27 static bool ValidateLossrate(const char* flagname, int value) { |
(...skipping 25 matching lines...) Expand all Loading... |
52 int main(int argc, char* argv[]) { | 53 int main(int argc, char* argv[]) { |
53 std::string program_name = argv[0]; | 54 std::string program_name = argv[0]; |
54 std::string usage = "Tool for measuring the speed of NetEq.\n" | 55 std::string usage = "Tool for measuring the speed of NetEq.\n" |
55 "Usage: " + program_name + " [options]\n\n" | 56 "Usage: " + program_name + " [options]\n\n" |
56 " --runtime_ms=N runtime in ms; default is 10000 ms\n" | 57 " --runtime_ms=N runtime in ms; default is 10000 ms\n" |
57 " --lossrate=N drop every N packets; default is 10\n" | 58 " --lossrate=N drop every N packets; default is 10\n" |
58 " --drift=F clockdrift factor between 0.0 and 1.0; " | 59 " --drift=F clockdrift factor between 0.0 and 1.0; " |
59 "default is 0.1\n"; | 60 "default is 0.1\n"; |
60 google::SetUsageMessage(usage); | 61 google::SetUsageMessage(usage); |
61 google::ParseCommandLineFlags(&argc, &argv, true); | 62 google::ParseCommandLineFlags(&argc, &argv, true); |
| 63 webrtc::test::SetExecutablePath(argv[0]); |
62 | 64 |
63 if (argc != 1) { | 65 if (argc != 1) { |
64 // Print usage information. | 66 // Print usage information. |
65 std::cout << google::ProgramUsage(); | 67 std::cout << google::ProgramUsage(); |
66 return 0; | 68 return 0; |
67 } | 69 } |
68 | 70 |
69 int64_t result = | 71 int64_t result = |
70 webrtc::test::NetEqPerformanceTest::Run(FLAGS_runtime_ms, FLAGS_lossrate, | 72 webrtc::test::NetEqPerformanceTest::Run(FLAGS_runtime_ms, FLAGS_lossrate, |
71 FLAGS_drift); | 73 FLAGS_drift); |
72 if (result <= 0) { | 74 if (result <= 0) { |
73 std::cout << "There was an error" << std::endl; | 75 std::cout << "There was an error" << std::endl; |
74 return -1; | 76 return -1; |
75 } | 77 } |
76 | 78 |
77 std::cout << "Simulation done" << std::endl; | 79 std::cout << "Simulation done" << std::endl; |
78 std::cout << "Runtime = " << result << " ms" << std::endl; | 80 std::cout << "Runtime = " << result << " ms" << std::endl; |
79 return 0; | 81 return 0; |
80 } | 82 } |
OLD | NEW |