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

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

Issue 2738543002: Remove VoEAudioProcessing interface. (Closed)
Patch Set: rebase Created 3 years, 9 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
(Empty)
1 /*
2 * Copyright (c) 2012 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 "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h"
12
13 class EcMetricsTest : public AfterStreamingFixture {
14 };
15
16 // Duplicated in apm_helpers_unittest.cc.
17 TEST_F(EcMetricsTest, EcMetricsAreOnByDefault) {
18 // AEC must be enabled fist.
19 EXPECT_EQ(0, voe_apm_->SetEcStatus(true, webrtc::kEcAec));
20
21 bool enabled = false;
22 EXPECT_EQ(0, voe_apm_->GetEcMetricsStatus(enabled));
23 EXPECT_TRUE(enabled);
24 }
25
26 // Duplicated in apm_helpers_unittest.cc.
27 TEST_F(EcMetricsTest, CanEnableAndDisableEcMetrics) {
28 // AEC must be enabled fist.
29 EXPECT_EQ(0, voe_apm_->SetEcStatus(true, webrtc::kEcAec));
30
31 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
32 bool ec_on = false;
33 EXPECT_EQ(0, voe_apm_->GetEcMetricsStatus(ec_on));
34 ASSERT_TRUE(ec_on);
35 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(false));
36 EXPECT_EQ(0, voe_apm_->GetEcMetricsStatus(ec_on));
37 ASSERT_FALSE(ec_on);
38 }
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.
42 TEST_F(EcMetricsTest, ManualTestEcMetrics) {
43 SwitchToManualMicrophone();
44
45 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
46
47 // Must enable AEC to get valid echo metrics.
48 EXPECT_EQ(0, voe_apm_->SetEcStatus(true, webrtc::kEcAec));
49
50 TEST_LOG("Speak into microphone and check metrics for 5 seconds...\n");
51 int erl, erle, rerl, a_nlp;
52 int delay_median = 0;
53 int delay_std = 0;
54 float fraction_poor_delays = 0;
55
56 for (int i = 0; i < 5; i++) {
57 Sleep(1000);
58 EXPECT_EQ(0, voe_apm_->GetEchoMetrics(erl, erle, rerl, a_nlp));
59 EXPECT_EQ(0, voe_apm_->GetEcDelayMetrics(delay_median, delay_std,
60 fraction_poor_delays));
61 TEST_LOG(" Echo : ERL=%5d, ERLE=%5d, RERL=%5d, A_NLP=%5d [dB], "
62 " delay median=%3d, delay std=%3d [ms], "
63 "fraction_poor_delays=%3.1f [%%]\n", erl, erle, rerl, a_nlp,
64 delay_median, delay_std, fraction_poor_delays * 100);
65 }
66
67 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(false));
68 }
69
70 // Duplicated in apm_helpers_unittest.cc.
71 TEST_F(EcMetricsTest, GetEcMetricsFailsIfEcNotEnabled) {
72 int dummy = 0;
73 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
74 EXPECT_EQ(-1, voe_apm_->GetEchoMetrics(dummy, dummy, dummy, dummy));
75 EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError());
76 }
77
78 // Duplicated in apm_helpers_unittest.cc.
79 TEST_F(EcMetricsTest, GetEcDelayMetricsFailsIfEcNotEnabled) {
80 int dummy = 0;
81 float dummy_f = 0;
82 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
83 EXPECT_EQ(-1, voe_apm_->GetEcDelayMetrics(dummy, dummy, dummy_f));
84 EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError());
85 }
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.
89 TEST_F(EcMetricsTest, ManualVerifyEcDelayMetrics) {
90 SwitchToManualMicrophone();
91 TEST_LOG("Verify EC Delay metrics:");
92 EXPECT_EQ(0, voe_apm_->SetEcStatus(true));
93 EXPECT_EQ(0, voe_apm_->SetEcMetricsStatus(true));
94
95 for (int i = 0; i < 5; i++) {
96 int delay, delay_std;
97 float fraction_poor_delays;
98 EXPECT_EQ(0, voe_apm_->GetEcDelayMetrics(delay, delay_std,
99 fraction_poor_delays));
100 TEST_LOG("Delay = %d, Delay Std = %d, Fraction poor delays = %3.1f\n",
101 delay, delay_std, fraction_poor_delays * 100);
102 Sleep(1000);
103 }
104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698