| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 "webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.h" | 11 #include "webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.h" |
| 12 #include "webrtc/test/gtest.h" | 12 #include "webrtc/test/gtest.h" |
| 13 #include "webrtc/test/testsupport/perf_test.h" | 13 #include "webrtc/test/testsupport/perf_test.h" |
| 14 #include "webrtc/typedefs.h" | 14 #include "webrtc/typedefs.h" |
| 15 #include "webrtc/system_wrappers/include/field_trial.h" | 15 #include "webrtc/system_wrappers/include/field_trial.h" |
| 16 | 16 |
| 17 // Runs a test with 10% packet losses and 10% clock drift, to exercise | 17 // Runs a test with 10% packet losses and 10% clock drift, to exercise |
| 18 // both loss concealment and time-stretching code. | 18 // both loss concealment and time-stretching code. |
| 19 TEST(NetEqPerformanceTest, Run) { | 19 TEST(NetEqPerformanceTest, Run) { |
| 20 const int kSimulationTimeMs = 10000000; | 20 const int kSimulationTimeMs = 10000000; |
| 21 const int kQuickSimulationTimeMs = 100000; | 21 const int kQuickSimulationTimeMs = 100000; |
| 22 const int kLossPeriod = 10; // Drop every 10th packet. | 22 const int kLossPeriod = 10; // Drop every 10th packet. |
| 23 const double kDriftFactor = 0.1; | 23 const double kDriftFactor = 0.1; |
| 24 int64_t runtime = webrtc::test::NetEqPerformanceTest::Run( | 24 int64_t runtime = webrtc::test::NetEqPerformanceTest::Run( |
| 25 webrtc::field_trial::FindFullName("WebRTC-QuickPerfTest") == "Enabled" | 25 webrtc::field_trial::IsEnabled("WebRTC-QuickPerfTest") |
| 26 ? kQuickSimulationTimeMs | 26 ? kQuickSimulationTimeMs |
| 27 : kSimulationTimeMs, | 27 : kSimulationTimeMs, |
| 28 kLossPeriod, kDriftFactor); | 28 kLossPeriod, kDriftFactor); |
| 29 ASSERT_GT(runtime, 0); | 29 ASSERT_GT(runtime, 0); |
| 30 webrtc::test::PrintResult( | 30 webrtc::test::PrintResult( |
| 31 "neteq_performance", "", "10_pl_10_drift", runtime, "ms", true); | 31 "neteq_performance", "", "10_pl_10_drift", runtime, "ms", true); |
| 32 } | 32 } |
| 33 | 33 |
| 34 // Runs a test with neither packet losses nor clock drift, to put | 34 // Runs a test with neither packet losses nor clock drift, to put |
| 35 // emphasis on the "good-weather" code path, which is presumably much | 35 // emphasis on the "good-weather" code path, which is presumably much |
| 36 // more lightweight. | 36 // more lightweight. |
| 37 TEST(NetEqPerformanceTest, RunClean) { | 37 TEST(NetEqPerformanceTest, RunClean) { |
| 38 const int kSimulationTimeMs = 10000000; | 38 const int kSimulationTimeMs = 10000000; |
| 39 const int kQuickSimulationTimeMs = 100000; | 39 const int kQuickSimulationTimeMs = 100000; |
| 40 const int kLossPeriod = 0; // No losses. | 40 const int kLossPeriod = 0; // No losses. |
| 41 const double kDriftFactor = 0.0; // No clock drift. | 41 const double kDriftFactor = 0.0; // No clock drift. |
| 42 int64_t runtime = webrtc::test::NetEqPerformanceTest::Run( | 42 int64_t runtime = webrtc::test::NetEqPerformanceTest::Run( |
| 43 webrtc::field_trial::FindFullName("WebRTC-QuickPerfTest") == "Enabled" | 43 webrtc::field_trial::IsEnabled("WebRTC-QuickPerfTest") |
| 44 ? kQuickSimulationTimeMs | 44 ? kQuickSimulationTimeMs |
| 45 : kSimulationTimeMs, | 45 : kSimulationTimeMs, |
| 46 kLossPeriod, kDriftFactor); | 46 kLossPeriod, kDriftFactor); |
| 47 ASSERT_GT(runtime, 0); | 47 ASSERT_GT(runtime, 0); |
| 48 webrtc::test::PrintResult( | 48 webrtc::test::PrintResult( |
| 49 "neteq_performance", "", "0_pl_0_drift", runtime, "ms", true); | 49 "neteq_performance", "", "0_pl_0_drift", runtime, "ms", true); |
| 50 } | 50 } |
| OLD | NEW |