| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 355 |
| 356 // Get audio from NetEq. | 356 // Get audio from NetEq. |
| 357 NetEqOutputType type; | 357 NetEqOutputType type; |
| 358 int num_channels; | 358 int num_channels; |
| 359 ASSERT_EQ(0, neteq_->GetAudio(kMaxBlockSize, out_data_, out_len, | 359 ASSERT_EQ(0, neteq_->GetAudio(kMaxBlockSize, out_data_, out_len, |
| 360 &num_channels, &type)); | 360 &num_channels, &type)); |
| 361 ASSERT_TRUE((*out_len == kBlockSize8kHz) || | 361 ASSERT_TRUE((*out_len == kBlockSize8kHz) || |
| 362 (*out_len == kBlockSize16kHz) || | 362 (*out_len == kBlockSize16kHz) || |
| 363 (*out_len == kBlockSize32kHz)); | 363 (*out_len == kBlockSize32kHz)); |
| 364 output_sample_rate_ = static_cast<int>(*out_len / 10 * 1000); | 364 output_sample_rate_ = static_cast<int>(*out_len / 10 * 1000); |
| 365 EXPECT_EQ(output_sample_rate_, neteq_->last_output_sample_rate_hz()); |
| 365 | 366 |
| 366 // Increase time. | 367 // Increase time. |
| 367 sim_clock_ += kTimeStepMs; | 368 sim_clock_ += kTimeStepMs; |
| 368 } | 369 } |
| 369 | 370 |
| 370 void NetEqDecodingTest::DecodeAndCompare(const std::string& rtp_file, | 371 void NetEqDecodingTest::DecodeAndCompare(const std::string& rtp_file, |
| 371 const std::string& ref_file, | 372 const std::string& ref_file, |
| 372 const std::string& stat_ref_file, | 373 const std::string& stat_ref_file, |
| 373 const std::string& rtcp_ref_file) { | 374 const std::string& rtcp_ref_file) { |
| 374 OpenInputFile(rtp_file); | 375 OpenInputFile(rtp_file); |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 &num_channels, &type)); | 889 &num_channels, &type)); |
| 889 // Verify that the first block of samples is set to 0. | 890 // Verify that the first block of samples is set to 0. |
| 890 static const int kExpectedOutputLength = | 891 static const int kExpectedOutputLength = |
| 891 kInitSampleRateHz / 100; // 10 ms at initial sample rate. | 892 kInitSampleRateHz / 100; // 10 ms at initial sample rate. |
| 892 for (int i = 0; i < kExpectedOutputLength; ++i) { | 893 for (int i = 0; i < kExpectedOutputLength; ++i) { |
| 893 std::ostringstream ss; | 894 std::ostringstream ss; |
| 894 ss << "i = " << i; | 895 ss << "i = " << i; |
| 895 SCOPED_TRACE(ss.str()); // Print out the parameter values on failure. | 896 SCOPED_TRACE(ss.str()); // Print out the parameter values on failure. |
| 896 EXPECT_EQ(0, out_data_[i]); | 897 EXPECT_EQ(0, out_data_[i]); |
| 897 } | 898 } |
| 899 // Verify that the sample rate did not change from the initial configuration. |
| 900 EXPECT_EQ(config_.sample_rate_hz, neteq_->last_output_sample_rate_hz()); |
| 898 } | 901 } |
| 899 | 902 |
| 900 class NetEqBgnTest : public NetEqDecodingTest { | 903 class NetEqBgnTest : public NetEqDecodingTest { |
| 901 protected: | 904 protected: |
| 902 virtual void TestCondition(double sum_squared_noise, | 905 virtual void TestCondition(double sum_squared_noise, |
| 903 bool should_be_faded) = 0; | 906 bool should_be_faded) = 0; |
| 904 | 907 |
| 905 void CheckBgn(int sampling_rate_hz) { | 908 void CheckBgn(int sampling_rate_hz) { |
| 906 size_t expected_samples_per_channel = 0; | 909 size_t expected_samples_per_channel = 0; |
| 907 uint8_t payload_type = 0xFF; // Invalid. | 910 uint8_t payload_type = 0xFF; // Invalid. |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1534 // Pull audio once. | 1537 // Pull audio once. |
| 1535 ASSERT_EQ(0, neteq_->GetAudio(kMaxBlockSize, out_data_, &out_len, | 1538 ASSERT_EQ(0, neteq_->GetAudio(kMaxBlockSize, out_data_, &out_len, |
| 1536 &num_channels, &type)); | 1539 &num_channels, &type)); |
| 1537 ASSERT_EQ(kBlockSize16kHz, out_len); | 1540 ASSERT_EQ(kBlockSize16kHz, out_len); |
| 1538 } | 1541 } |
| 1539 // Verify speech output. | 1542 // Verify speech output. |
| 1540 EXPECT_EQ(kOutputNormal, type); | 1543 EXPECT_EQ(kOutputNormal, type); |
| 1541 } | 1544 } |
| 1542 | 1545 |
| 1543 } // namespace webrtc | 1546 } // namespace webrtc |
| OLD | NEW |