| OLD | NEW |
| 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 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 EXPECT_EQ(0, voe_apm_->SetAgcConfig(agc_config)); | 57 EXPECT_EQ(0, voe_apm_->SetAgcConfig(agc_config)); |
| 58 EXPECT_EQ(0, voe_apm_->GetAgcConfig(actual_config)); | 58 EXPECT_EQ(0, voe_apm_->GetAgcConfig(actual_config)); |
| 59 | 59 |
| 60 EXPECT_EQ(agc_config.digitalCompressionGaindB, | 60 EXPECT_EQ(agc_config.digitalCompressionGaindB, |
| 61 actual_config.digitalCompressionGaindB); | 61 actual_config.digitalCompressionGaindB); |
| 62 EXPECT_EQ(agc_config.limiterEnable, | 62 EXPECT_EQ(agc_config.limiterEnable, |
| 63 actual_config.limiterEnable); | 63 actual_config.limiterEnable); |
| 64 EXPECT_EQ(agc_config.targetLeveldBOv, | 64 EXPECT_EQ(agc_config.targetLeveldBOv, |
| 65 actual_config.targetLeveldBOv); | 65 actual_config.targetLeveldBOv); |
| 66 } | 66 } |
| 67 | |
| 68 TEST_F(AgcConfigTest, HasCorrectDefaultRxConfiguration) { | |
| 69 webrtc::AgcConfig agc_config; | |
| 70 | |
| 71 EXPECT_EQ(0, voe_apm_->GetRxAgcConfig(channel_, agc_config)); | |
| 72 | |
| 73 EXPECT_EQ(default_agc_config_.targetLeveldBOv, agc_config.targetLeveldBOv); | |
| 74 EXPECT_EQ(default_agc_config_.digitalCompressionGaindB, | |
| 75 agc_config.digitalCompressionGaindB); | |
| 76 EXPECT_EQ(default_agc_config_.limiterEnable, agc_config.limiterEnable); | |
| 77 } | |
| 78 | |
| 79 TEST_F(AgcConfigTest, DealsWithInvalidRxParameters) { | |
| 80 webrtc::AgcConfig agc_config = default_agc_config_; | |
| 81 agc_config.digitalCompressionGaindB = 91; | |
| 82 EXPECT_EQ(-1, voe_apm_->SetRxAgcConfig(channel_, agc_config)) << | |
| 83 "Should not be able to set RX gain to more than 90 dB."; | |
| 84 EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError()); | |
| 85 | |
| 86 agc_config = default_agc_config_; | |
| 87 agc_config.targetLeveldBOv = 32; | |
| 88 EXPECT_EQ(-1, voe_apm_->SetRxAgcConfig(channel_, agc_config)) << | |
| 89 "Should not be able to set target level to more than 31."; | |
| 90 EXPECT_EQ(VE_APM_ERROR, voe_base_->LastError()); | |
| 91 } | |
| 92 | |
| 93 TEST_F(AgcConfigTest, CanGetAndSetRxAgcStatus) { | |
| 94 webrtc::AgcConfig agc_config; | |
| 95 agc_config.digitalCompressionGaindB = 17; | |
| 96 agc_config.targetLeveldBOv = 11; | |
| 97 agc_config.limiterEnable = false; | |
| 98 | |
| 99 webrtc::AgcConfig actual_config; | |
| 100 EXPECT_EQ(0, voe_apm_->SetRxAgcConfig(channel_, agc_config)); | |
| 101 EXPECT_EQ(0, voe_apm_->GetRxAgcConfig(channel_, actual_config)); | |
| 102 | |
| 103 EXPECT_EQ(agc_config.digitalCompressionGaindB, | |
| 104 actual_config.digitalCompressionGaindB); | |
| 105 EXPECT_EQ(agc_config.limiterEnable, | |
| 106 actual_config.limiterEnable); | |
| 107 EXPECT_EQ(agc_config.targetLeveldBOv, | |
| 108 actual_config.targetLeveldBOv); | |
| 109 } | |
| OLD | NEW |