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 16 matching lines...) Expand all Loading... |
27 namespace { | 27 namespace { |
28 static const size_t kMockMaxEncodedBytes = 1000; | 28 static const size_t kMockMaxEncodedBytes = 1000; |
29 static const size_t kMaxNumSamples = 48 * 10 * 2; // 10 ms @ 48 kHz stereo. | 29 static const size_t kMaxNumSamples = 48 * 10 * 2; // 10 ms @ 48 kHz stereo. |
30 static const size_t kMockReturnEncodedBytes = 17; | 30 static const size_t kMockReturnEncodedBytes = 17; |
31 static const int kCngPayloadType = 18; | 31 static const int kCngPayloadType = 18; |
32 } | 32 } |
33 | 33 |
34 class AudioEncoderCngTest : public ::testing::Test { | 34 class AudioEncoderCngTest : public ::testing::Test { |
35 protected: | 35 protected: |
36 AudioEncoderCngTest() | 36 AudioEncoderCngTest() |
37 : mock_vad_(new MockVad(Vad::kVadNormal)), | 37 : mock_vad_(new MockVad), |
38 timestamp_(4711), | 38 timestamp_(4711), |
39 num_audio_samples_10ms_(0), | 39 num_audio_samples_10ms_(0), |
40 sample_rate_hz_(8000) { | 40 sample_rate_hz_(8000) { |
41 memset(audio_, 0, kMaxNumSamples * 2); | 41 memset(audio_, 0, kMaxNumSamples * 2); |
42 config_.speech_encoder = &mock_encoder_; | 42 config_.speech_encoder = &mock_encoder_; |
43 EXPECT_CALL(mock_encoder_, NumChannels()).WillRepeatedly(Return(1)); | 43 EXPECT_CALL(mock_encoder_, NumChannels()).WillRepeatedly(Return(1)); |
44 // Let the AudioEncoderCng object use a MockVad instead of its internally | 44 // Let the AudioEncoderCng object use a MockVad instead of its internally |
45 // created Vad object. | 45 // created Vad object. |
46 config_.vad = mock_vad_; | 46 config_.vad = mock_vad_; |
47 config_.payload_type = kCngPayloadType; | 47 config_.payload_type = kCngPayloadType; |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 .WillRepeatedly(Return(7U)); | 455 .WillRepeatedly(Return(7U)); |
456 for (int i = 0; i < 6; ++i) | 456 for (int i = 0; i < 6; ++i) |
457 Encode(); | 457 Encode(); |
458 EXPECT_DEATH(Encode(), | 458 EXPECT_DEATH(Encode(), |
459 "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."); |
460 } | 460 } |
461 | 461 |
462 #endif // GTEST_HAS_DEATH_TEST | 462 #endif // GTEST_HAS_DEATH_TEST |
463 | 463 |
464 } // namespace webrtc | 464 } // namespace webrtc |
OLD | NEW |