Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: webrtc/voice_engine/test/auto_test/extended/ec_metrics_test.cc

Issue 2681033010: Remove usage of VoEAudioProcessing from WVoE/MC. (Closed)
Patch Set: one more Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h" 11 #include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h"
12 12
13 class EcMetricsTest : public AfterStreamingFixture { 13 class EcMetricsTest : public AfterStreamingFixture {
14 }; 14 };
15 15
16 // Duplicated in apm_helpers_unittest.cc.
16 TEST_F(EcMetricsTest, EcMetricsAreOnByDefault) { 17 TEST_F(EcMetricsTest, EcMetricsAreOnByDefault) {
17 // AEC must be enabled fist. 18 // AEC must be enabled fist.
18 EXPECT_EQ(0, voe_apm_->SetEcStatus(true, webrtc::kEcAec)); 19 EXPECT_EQ(0, voe_apm_->SetEcStatus(true, webrtc::kEcAec));
19 20
20 bool enabled = false; 21 bool enabled = false;
21 EXPECT_EQ(0, voe_apm_->GetEcMetricsStatus(enabled)); 22 EXPECT_EQ(0, voe_apm_->GetEcMetricsStatus(enabled));
22 EXPECT_TRUE(enabled); 23 EXPECT_TRUE(enabled);
23 } 24 }
24 25
26 // Duplicated in apm_helpers_unittest.cc.
25 TEST_F(EcMetricsTest, CanEnableAndDisableEcMetrics) { 27 TEST_F(EcMetricsTest, CanEnableAndDisableEcMetrics) {
26 // AEC must be enabled fist. 28 // AEC must be enabled fist.
27 EXPECT_EQ(0, voe_apm_->SetEcStatus(true, webrtc::kEcAec)); 29 EXPECT_EQ(0, voe_apm_->SetEcStatus(true, webrtc::kEcAec));
28 30
29 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true)); 31 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
30 bool ec_on = false; 32 bool ec_on = false;
31 EXPECT_EQ(0, voe_apm_->GetEcMetricsStatus(ec_on)); 33 EXPECT_EQ(0, voe_apm_->GetEcMetricsStatus(ec_on));
32 ASSERT_TRUE(ec_on); 34 ASSERT_TRUE(ec_on);
33 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(false)); 35 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(false));
34 EXPECT_EQ(0, voe_apm_->GetEcMetricsStatus(ec_on)); 36 EXPECT_EQ(0, voe_apm_->GetEcMetricsStatus(ec_on));
35 ASSERT_FALSE(ec_on); 37 ASSERT_FALSE(ec_on);
36 } 38 }
37 39
40 // TODO(solenberg): Do we have higher or lower level tests that verify metrics?
41 // It's not the right test for this level.
38 TEST_F(EcMetricsTest, ManualTestEcMetrics) { 42 TEST_F(EcMetricsTest, ManualTestEcMetrics) {
39 SwitchToManualMicrophone(); 43 SwitchToManualMicrophone();
40 44
41 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true)); 45 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
42 46
43 // Must enable AEC to get valid echo metrics. 47 // Must enable AEC to get valid echo metrics.
44 EXPECT_EQ(0, voe_apm_->SetEcStatus(true, webrtc::kEcAec)); 48 EXPECT_EQ(0, voe_apm_->SetEcStatus(true, webrtc::kEcAec));
45 49
46 TEST_LOG("Speak into microphone and check metrics for 5 seconds...\n"); 50 TEST_LOG("Speak into microphone and check metrics for 5 seconds...\n");
47 int erl, erle, rerl, a_nlp; 51 int erl, erle, rerl, a_nlp;
48 int delay_median = 0; 52 int delay_median = 0;
49 int delay_std = 0; 53 int delay_std = 0;
50 float fraction_poor_delays = 0; 54 float fraction_poor_delays = 0;
51 55
52 for (int i = 0; i < 5; i++) { 56 for (int i = 0; i < 5; i++) {
53 Sleep(1000); 57 Sleep(1000);
54 EXPECT_EQ(0, voe_apm_->GetEchoMetrics(erl, erle, rerl, a_nlp)); 58 EXPECT_EQ(0, voe_apm_->GetEchoMetrics(erl, erle, rerl, a_nlp));
55 EXPECT_EQ(0, voe_apm_->GetEcDelayMetrics(delay_median, delay_std, 59 EXPECT_EQ(0, voe_apm_->GetEcDelayMetrics(delay_median, delay_std,
56 fraction_poor_delays)); 60 fraction_poor_delays));
57 TEST_LOG(" Echo : ERL=%5d, ERLE=%5d, RERL=%5d, A_NLP=%5d [dB], " 61 TEST_LOG(" Echo : ERL=%5d, ERLE=%5d, RERL=%5d, A_NLP=%5d [dB], "
58 " delay median=%3d, delay std=%3d [ms], " 62 " delay median=%3d, delay std=%3d [ms], "
59 "fraction_poor_delays=%3.1f [%%]\n", erl, erle, rerl, a_nlp, 63 "fraction_poor_delays=%3.1f [%%]\n", erl, erle, rerl, a_nlp,
60 delay_median, delay_std, fraction_poor_delays * 100); 64 delay_median, delay_std, fraction_poor_delays * 100);
61 } 65 }
62 66
63 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(false)); 67 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(false));
64 } 68 }
65 69
70 // Duplicated in apm_helpers_unittest.cc.
66 TEST_F(EcMetricsTest, GetEcMetricsFailsIfEcNotEnabled) { 71 TEST_F(EcMetricsTest, GetEcMetricsFailsIfEcNotEnabled) {
67 int dummy = 0; 72 int dummy = 0;
68 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true)); 73 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
69 EXPECT_EQ(-1, voe_apm_->GetEchoMetrics(dummy, dummy, dummy, dummy)); 74 EXPECT_EQ(-1, voe_apm_->GetEchoMetrics(dummy, dummy, dummy, dummy));
70 EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError()); 75 EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError());
71 } 76 }
72 77
78 // Duplicated in apm_helpers_unittest.cc.
73 TEST_F(EcMetricsTest, GetEcDelayMetricsFailsIfEcNotEnabled) { 79 TEST_F(EcMetricsTest, GetEcDelayMetricsFailsIfEcNotEnabled) {
74 int dummy = 0; 80 int dummy = 0;
75 float dummy_f = 0; 81 float dummy_f = 0;
76 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true)); 82 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
77 EXPECT_EQ(-1, voe_apm_->GetEcDelayMetrics(dummy, dummy, dummy_f)); 83 EXPECT_EQ(-1, voe_apm_->GetEcDelayMetrics(dummy, dummy, dummy_f));
78 EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError()); 84 EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError());
79 } 85 }
80 86
87 // TODO(solenberg): Do we have higher or lower level tests that verify metrics?
88 // It's not the right test for this level.
81 TEST_F(EcMetricsTest, ManualVerifyEcDelayMetrics) { 89 TEST_F(EcMetricsTest, ManualVerifyEcDelayMetrics) {
82 SwitchToManualMicrophone(); 90 SwitchToManualMicrophone();
83 TEST_LOG("Verify EC Delay metrics:"); 91 TEST_LOG("Verify EC Delay metrics:");
84 EXPECT_EQ(0, voe_apm_->SetEcStatus(true)); 92 EXPECT_EQ(0, voe_apm_->SetEcStatus(true));
85 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true)); 93 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
86 94
87 for (int i = 0; i < 5; i++) { 95 for (int i = 0; i < 5; i++) {
88 int delay, delay_std; 96 int delay, delay_std;
89 float fraction_poor_delays; 97 float fraction_poor_delays;
90 EXPECT_EQ(0, voe_apm_->GetEcDelayMetrics(delay, delay_std, 98 EXPECT_EQ(0, voe_apm_->GetEcDelayMetrics(delay, delay_std,
91 fraction_poor_delays)); 99 fraction_poor_delays));
92 TEST_LOG("Delay = %d, Delay Std = %d, Fraction poor delays = %3.1f\n", 100 TEST_LOG("Delay = %d, Delay Std = %d, Fraction poor delays = %3.1f\n",
93 delay, delay_std, fraction_poor_delays * 100); 101 delay, delay_std, fraction_poor_delays * 100);
94 Sleep(1000); 102 Sleep(1000);
95 } 103 }
96 } 104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698