| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 EXPECT_CALL(mock_encoder_, MaxEncodedBytes()) | 70 EXPECT_CALL(mock_encoder_, MaxEncodedBytes()) |
| 71 .WillRepeatedly(Return(kMockMaxEncodedBytes)); | 71 .WillRepeatedly(Return(kMockMaxEncodedBytes)); |
| 72 cng_.reset(new AudioEncoderCng(config_)); | 72 cng_.reset(new AudioEncoderCng(config_)); |
| 73 encoded_.resize(cng_->MaxEncodedBytes(), 0); | 73 encoded_.resize(cng_->MaxEncodedBytes(), 0); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void Encode() { | 76 void Encode() { |
| 77 ASSERT_TRUE(cng_) << "Must call CreateCng() first."; | 77 ASSERT_TRUE(cng_) << "Must call CreateCng() first."; |
| 78 encoded_info_ = cng_->Encode(timestamp_, audio_, num_audio_samples_10ms_, | 78 encoded_info_ = cng_->Encode(timestamp_, audio_, num_audio_samples_10ms_, |
| 79 encoded_.size(), &encoded_[0]); | 79 encoded_.size(), &encoded_[0]); |
| 80 timestamp_ += num_audio_samples_10ms_; | 80 timestamp_ += static_cast<uint32_t>(num_audio_samples_10ms_); |
| 81 } | 81 } |
| 82 | 82 |
| 83 // Expect |num_calls| calls to the encoder, all successful. The last call | 83 // Expect |num_calls| calls to the encoder, all successful. The last call |
| 84 // claims to have encoded |kMockMaxEncodedBytes| bytes, and all the preceding | 84 // claims to have encoded |kMockMaxEncodedBytes| bytes, and all the preceding |
| 85 // ones 0 bytes. | 85 // ones 0 bytes. |
| 86 void ExpectEncodeCalls(int num_calls) { | 86 void ExpectEncodeCalls(int num_calls) { |
| 87 InSequence s; | 87 InSequence s; |
| 88 AudioEncoder::EncodedInfo info; | 88 AudioEncoder::EncodedInfo info; |
| 89 for (int j = 0; j < num_calls - 1; ++j) { | 89 for (int j = 0; j < num_calls - 1; ++j) { |
| 90 EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _, _)) | 90 EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _, _)) |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 .WillRepeatedly(Return(7)); | 446 .WillRepeatedly(Return(7)); |
| 447 for (int i = 0; i < 6; ++i) | 447 for (int i = 0; i < 6; ++i) |
| 448 Encode(); | 448 Encode(); |
| 449 EXPECT_DEATH(Encode(), | 449 EXPECT_DEATH(Encode(), |
| 450 "Frame size cannot be larger than 60 ms when using VAD/CNG."); | 450 "Frame size cannot be larger than 60 ms when using VAD/CNG."); |
| 451 } | 451 } |
| 452 | 452 |
| 453 #endif // GTEST_HAS_DEATH_TEST | 453 #endif // GTEST_HAS_DEATH_TEST |
| 454 | 454 |
| 455 } // namespace webrtc | 455 } // namespace webrtc |
| OLD | NEW |