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 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 TEST_F(AudioCodingModuleTestOldApi, MAYBE_InitializedToZero) { | 246 TEST_F(AudioCodingModuleTestOldApi, MAYBE_InitializedToZero) { |
247 RegisterCodec(); | 247 RegisterCodec(); |
248 AudioDecodingCallStats stats; | 248 AudioDecodingCallStats stats; |
249 acm_->GetDecodingCallStatistics(&stats); | 249 acm_->GetDecodingCallStatistics(&stats); |
250 EXPECT_EQ(0, stats.calls_to_neteq); | 250 EXPECT_EQ(0, stats.calls_to_neteq); |
251 EXPECT_EQ(0, stats.calls_to_silence_generator); | 251 EXPECT_EQ(0, stats.calls_to_silence_generator); |
252 EXPECT_EQ(0, stats.decoded_normal); | 252 EXPECT_EQ(0, stats.decoded_normal); |
253 EXPECT_EQ(0, stats.decoded_cng); | 253 EXPECT_EQ(0, stats.decoded_cng); |
254 EXPECT_EQ(0, stats.decoded_plc); | 254 EXPECT_EQ(0, stats.decoded_plc); |
255 EXPECT_EQ(0, stats.decoded_plc_cng); | 255 EXPECT_EQ(0, stats.decoded_plc_cng); |
| 256 EXPECT_EQ(0, stats.decoded_muted_output); |
256 } | 257 } |
257 | 258 |
258 // Insert some packets and pull audio. Check statistics are valid. Then, | 259 // Insert some packets and pull audio. Check statistics are valid. Then, |
259 // simulate packet loss and check if PLC and PLC-to-CNG statistics are | 260 // simulate packet loss and check if PLC and PLC-to-CNG statistics are |
260 // correctly updated. | 261 // correctly updated. |
261 #if defined(WEBRTC_ANDROID) | 262 #if defined(WEBRTC_ANDROID) |
262 #define MAYBE_NetEqCalls DISABLED_NetEqCalls | 263 #define MAYBE_NetEqCalls DISABLED_NetEqCalls |
263 #else | 264 #else |
264 #define MAYBE_NetEqCalls NetEqCalls | 265 #define MAYBE_NetEqCalls NetEqCalls |
265 #endif | 266 #endif |
266 TEST_F(AudioCodingModuleTestOldApi, MAYBE_NetEqCalls) { | 267 TEST_F(AudioCodingModuleTestOldApi, MAYBE_NetEqCalls) { |
267 RegisterCodec(); | 268 RegisterCodec(); |
268 AudioDecodingCallStats stats; | 269 AudioDecodingCallStats stats; |
269 const int kNumNormalCalls = 10; | 270 const int kNumNormalCalls = 10; |
270 | 271 |
271 for (int num_calls = 0; num_calls < kNumNormalCalls; ++num_calls) { | 272 for (int num_calls = 0; num_calls < kNumNormalCalls; ++num_calls) { |
272 InsertPacketAndPullAudio(); | 273 InsertPacketAndPullAudio(); |
273 } | 274 } |
274 acm_->GetDecodingCallStatistics(&stats); | 275 acm_->GetDecodingCallStatistics(&stats); |
275 EXPECT_EQ(kNumNormalCalls, stats.calls_to_neteq); | 276 EXPECT_EQ(kNumNormalCalls, stats.calls_to_neteq); |
276 EXPECT_EQ(0, stats.calls_to_silence_generator); | 277 EXPECT_EQ(0, stats.calls_to_silence_generator); |
277 EXPECT_EQ(kNumNormalCalls, stats.decoded_normal); | 278 EXPECT_EQ(kNumNormalCalls, stats.decoded_normal); |
278 EXPECT_EQ(0, stats.decoded_cng); | 279 EXPECT_EQ(0, stats.decoded_cng); |
279 EXPECT_EQ(0, stats.decoded_plc); | 280 EXPECT_EQ(0, stats.decoded_plc); |
280 EXPECT_EQ(0, stats.decoded_plc_cng); | 281 EXPECT_EQ(0, stats.decoded_plc_cng); |
| 282 EXPECT_EQ(0, stats.decoded_muted_output); |
281 | 283 |
282 const int kNumPlc = 3; | 284 const int kNumPlc = 3; |
283 const int kNumPlcCng = 5; | 285 const int kNumPlcCng = 5; |
284 | 286 |
285 // Simulate packet-loss. NetEq first performs PLC then PLC fades to CNG. | 287 // Simulate packet-loss. NetEq first performs PLC then PLC fades to CNG. |
286 for (int n = 0; n < kNumPlc + kNumPlcCng; ++n) { | 288 for (int n = 0; n < kNumPlc + kNumPlcCng; ++n) { |
287 PullAudio(); | 289 PullAudio(); |
288 } | 290 } |
289 acm_->GetDecodingCallStatistics(&stats); | 291 acm_->GetDecodingCallStatistics(&stats); |
290 EXPECT_EQ(kNumNormalCalls + kNumPlc + kNumPlcCng, stats.calls_to_neteq); | 292 EXPECT_EQ(kNumNormalCalls + kNumPlc + kNumPlcCng, stats.calls_to_neteq); |
291 EXPECT_EQ(0, stats.calls_to_silence_generator); | 293 EXPECT_EQ(0, stats.calls_to_silence_generator); |
292 EXPECT_EQ(kNumNormalCalls, stats.decoded_normal); | 294 EXPECT_EQ(kNumNormalCalls, stats.decoded_normal); |
293 EXPECT_EQ(0, stats.decoded_cng); | 295 EXPECT_EQ(0, stats.decoded_cng); |
294 EXPECT_EQ(kNumPlc, stats.decoded_plc); | 296 EXPECT_EQ(kNumPlc, stats.decoded_plc); |
295 EXPECT_EQ(kNumPlcCng, stats.decoded_plc_cng); | 297 EXPECT_EQ(kNumPlcCng, stats.decoded_plc_cng); |
| 298 EXPECT_EQ(0, stats.decoded_muted_output); |
| 299 // TODO(henrik.lundin) Add a test with muted state enabled. |
296 } | 300 } |
297 | 301 |
298 TEST_F(AudioCodingModuleTestOldApi, VerifyOutputFrame) { | 302 TEST_F(AudioCodingModuleTestOldApi, VerifyOutputFrame) { |
299 AudioFrame audio_frame; | 303 AudioFrame audio_frame; |
300 const int kSampleRateHz = 32000; | 304 const int kSampleRateHz = 32000; |
301 bool muted; | 305 bool muted; |
302 EXPECT_EQ(0, acm_->PlayoutData10Ms(kSampleRateHz, &audio_frame, &muted)); | 306 EXPECT_EQ(0, acm_->PlayoutData10Ms(kSampleRateHz, &audio_frame, &muted)); |
303 ASSERT_FALSE(muted); | 307 ASSERT_FALSE(muted); |
304 EXPECT_EQ(id_, audio_frame.id_); | 308 EXPECT_EQ(id_, audio_frame.id_); |
305 EXPECT_EQ(0u, audio_frame.timestamp_); | 309 EXPECT_EQ(0u, audio_frame.timestamp_); |
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1801 Run(16000, 8000, 1000); | 1805 Run(16000, 8000, 1000); |
1802 } | 1806 } |
1803 | 1807 |
1804 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { | 1808 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { |
1805 Run(8000, 16000, 1000); | 1809 Run(8000, 16000, 1000); |
1806 } | 1810 } |
1807 | 1811 |
1808 #endif | 1812 #endif |
1809 | 1813 |
1810 } // namespace webrtc | 1814 } // namespace webrtc |
OLD | NEW |