| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 379 |
| 380 // Go back to noise again, and verify that a SID frame is emitted. | 380 // Go back to noise again, and verify that a SID frame is emitted. |
| 381 EXPECT_CALL(*mock_vad_, VoiceActivity(_, _, _)) | 381 EXPECT_CALL(*mock_vad_, VoiceActivity(_, _, _)) |
| 382 .WillOnce(Return(Vad::kPassive)); | 382 .WillOnce(Return(Vad::kPassive)); |
| 383 Encode(); | 383 Encode(); |
| 384 EXPECT_EQ(kCngPayloadType, encoded_info_.payload_type); | 384 EXPECT_EQ(kCngPayloadType, encoded_info_.payload_type); |
| 385 EXPECT_EQ(static_cast<size_t>(config_.num_cng_coefficients) + 1, | 385 EXPECT_EQ(static_cast<size_t>(config_.num_cng_coefficients) + 1, |
| 386 encoded_info_.encoded_bytes); | 386 encoded_info_.encoded_bytes); |
| 387 } | 387 } |
| 388 | 388 |
| 389 // Resetting the CNG should reset both the VAD and the encoder. |
| 390 TEST_F(AudioEncoderCngTest, Reset) { |
| 391 CreateCng(); |
| 392 EXPECT_CALL(mock_encoder_, Reset()).Times(1); |
| 393 EXPECT_CALL(*mock_vad_, Reset()).Times(1); |
| 394 cng_->Reset(); |
| 395 } |
| 396 |
| 389 #if GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) | 397 #if GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
| 390 | 398 |
| 391 // This test fixture tests various error conditions that makes the | 399 // This test fixture tests various error conditions that makes the |
| 392 // AudioEncoderCng die via CHECKs. | 400 // AudioEncoderCng die via CHECKs. |
| 393 class AudioEncoderCngDeathTest : public AudioEncoderCngTest { | 401 class AudioEncoderCngDeathTest : public AudioEncoderCngTest { |
| 394 protected: | 402 protected: |
| 395 AudioEncoderCngDeathTest() : AudioEncoderCngTest() { | 403 AudioEncoderCngDeathTest() : AudioEncoderCngTest() { |
| 396 // Don't provide a Vad mock object, since it will leak when the test dies. | 404 // Don't provide a Vad mock object, since it will leak when the test dies. |
| 397 config_.vad = NULL; | 405 config_.vad = NULL; |
| 398 EXPECT_CALL(*mock_vad_, Die()).Times(1); | 406 EXPECT_CALL(*mock_vad_, Die()).Times(1); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 .WillRepeatedly(Return(7U)); | 455 .WillRepeatedly(Return(7U)); |
| 448 for (int i = 0; i < 6; ++i) | 456 for (int i = 0; i < 6; ++i) |
| 449 Encode(); | 457 Encode(); |
| 450 EXPECT_DEATH(Encode(), | 458 EXPECT_DEATH(Encode(), |
| 451 "Frame size cannot be larger than 60 ms when using VAD/CNG."); | 459 "Frame size cannot be larger than 60 ms when using VAD/CNG."); |
| 452 } | 460 } |
| 453 | 461 |
| 454 #endif // GTEST_HAS_DEATH_TEST | 462 #endif // GTEST_HAS_DEATH_TEST |
| 455 | 463 |
| 456 } // namespace webrtc | 464 } // namespace webrtc |
| OLD | NEW |