| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // different NetEq instances. The first instance uses the internal version of | 163 // different NetEq instances. The first instance uses the internal version of |
| 164 // the decoder object, while the second one uses an externally created decoder | 164 // the decoder object, while the second one uses an externally created decoder |
| 165 // object (ExternalPcm16B wrapped in MockExternalPcm16B, both defined above). | 165 // object (ExternalPcm16B wrapped in MockExternalPcm16B, both defined above). |
| 166 // The test verifies that the output from both instances match. | 166 // The test verifies that the output from both instances match. |
| 167 class NetEqExternalVsInternalDecoderTest : public NetEqExternalDecoderUnitTest, | 167 class NetEqExternalVsInternalDecoderTest : public NetEqExternalDecoderUnitTest, |
| 168 public ::testing::Test { | 168 public ::testing::Test { |
| 169 protected: | 169 protected: |
| 170 static const size_t kMaxBlockSize = 480; // 10 ms @ 48 kHz. | 170 static const size_t kMaxBlockSize = 480; // 10 ms @ 48 kHz. |
| 171 | 171 |
| 172 NetEqExternalVsInternalDecoderTest() | 172 NetEqExternalVsInternalDecoderTest() |
| 173 : NetEqExternalDecoderUnitTest(kDecoderPCM16Bswb32kHz, | 173 : NetEqExternalDecoderUnitTest(NetEqDecoder::kDecoderPCM16Bswb32kHz, |
| 174 new MockExternalPcm16B), | 174 new MockExternalPcm16B), |
| 175 sample_rate_hz_(CodecSampleRateHz(kDecoderPCM16Bswb32kHz)) { | 175 sample_rate_hz_( |
| 176 CodecSampleRateHz(NetEqDecoder::kDecoderPCM16Bswb32kHz)) { |
| 176 NetEq::Config config; | 177 NetEq::Config config; |
| 177 config.sample_rate_hz = CodecSampleRateHz(kDecoderPCM16Bswb32kHz); | 178 config.sample_rate_hz = |
| 179 CodecSampleRateHz(NetEqDecoder::kDecoderPCM16Bswb32kHz); |
| 178 neteq_internal_.reset(NetEq::Create(config)); | 180 neteq_internal_.reset(NetEq::Create(config)); |
| 179 } | 181 } |
| 180 | 182 |
| 181 void SetUp() override { | 183 void SetUp() override { |
| 182 ASSERT_EQ(NetEq::kOK, | 184 ASSERT_EQ(NetEq::kOK, |
| 183 neteq_internal_->RegisterPayloadType(kDecoderPCM16Bswb32kHz, | 185 neteq_internal_->RegisterPayloadType( |
| 184 kPayloadType)); | 186 NetEqDecoder::kDecoderPCM16Bswb32kHz, kPayloadType)); |
| 185 } | 187 } |
| 186 | 188 |
| 187 void GetAndVerifyOutput() override { | 189 void GetAndVerifyOutput() override { |
| 188 NetEqOutputType output_type; | 190 NetEqOutputType output_type; |
| 189 size_t samples_per_channel; | 191 size_t samples_per_channel; |
| 190 int num_channels; | 192 int num_channels; |
| 191 // Get audio from internal decoder instance. | 193 // Get audio from internal decoder instance. |
| 192 EXPECT_EQ(NetEq::kOK, | 194 EXPECT_EQ(NetEq::kOK, |
| 193 neteq_internal_->GetAudio(kMaxBlockSize, | 195 neteq_internal_->GetAudio(kMaxBlockSize, |
| 194 output_internal_, | 196 output_internal_, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 245 |
| 244 enum TestStates { | 246 enum TestStates { |
| 245 kInitialPhase, | 247 kInitialPhase, |
| 246 kNormalPhase, | 248 kNormalPhase, |
| 247 kExpandPhase, | 249 kExpandPhase, |
| 248 kFadedExpandPhase, | 250 kFadedExpandPhase, |
| 249 kRecovered | 251 kRecovered |
| 250 }; | 252 }; |
| 251 | 253 |
| 252 LargeTimestampJumpTest() | 254 LargeTimestampJumpTest() |
| 253 : NetEqExternalDecoderUnitTest(kDecoderPCM16B, | 255 : NetEqExternalDecoderUnitTest(NetEqDecoder::kDecoderPCM16B, |
| 254 new MockExternalPcm16B), | 256 new MockExternalPcm16B), |
| 255 test_state_(kInitialPhase) { | 257 test_state_(kInitialPhase) { |
| 256 EXPECT_CALL(*external_decoder(), HasDecodePlc()) | 258 EXPECT_CALL(*external_decoder(), HasDecodePlc()) |
| 257 .WillRepeatedly(Return(false)); | 259 .WillRepeatedly(Return(false)); |
| 258 } | 260 } |
| 259 | 261 |
| 260 virtual void UpdateState(NetEqOutputType output_type) { | 262 virtual void UpdateState(NetEqOutputType output_type) { |
| 261 switch (test_state_) { | 263 switch (test_state_) { |
| 262 case kInitialPhase: { | 264 case kInitialPhase: { |
| 263 if (output_type == kOutputNormal) { | 265 if (output_type == kOutputNormal) { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 kStartSeqeunceNumber, | 454 kStartSeqeunceNumber, |
| 453 kStartTimestamp, | 455 kStartTimestamp, |
| 454 kJumpFromTimestamp, | 456 kJumpFromTimestamp, |
| 455 kJumpToTimestamp)); | 457 kJumpToTimestamp)); |
| 456 | 458 |
| 457 RunTest(130); // Run 130 laps @ 10 ms each in the test loop. | 459 RunTest(130); // Run 130 laps @ 10 ms each in the test loop. |
| 458 EXPECT_EQ(kRecovered, test_state_); | 460 EXPECT_EQ(kRecovered, test_state_); |
| 459 } | 461 } |
| 460 | 462 |
| 461 } // namespace webrtc | 463 } // namespace webrtc |
| OLD | NEW |