| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 bool muted; | 193 bool muted; |
| 194 EXPECT_EQ(NetEq::kOK, neteq_internal_->GetAudio(&output_internal_, &muted)); | 194 EXPECT_EQ(NetEq::kOK, neteq_internal_->GetAudio(&output_internal_, &muted)); |
| 195 ASSERT_FALSE(muted); | 195 ASSERT_FALSE(muted); |
| 196 EXPECT_EQ(1u, output_internal_.num_channels_); | 196 EXPECT_EQ(1u, output_internal_.num_channels_); |
| 197 EXPECT_EQ(static_cast<size_t>(kOutputLengthMs * sample_rate_hz_ / 1000), | 197 EXPECT_EQ(static_cast<size_t>(kOutputLengthMs * sample_rate_hz_ / 1000), |
| 198 output_internal_.samples_per_channel_); | 198 output_internal_.samples_per_channel_); |
| 199 | 199 |
| 200 // Get audio from external decoder instance. | 200 // Get audio from external decoder instance. |
| 201 GetOutputAudio(&output_); | 201 GetOutputAudio(&output_); |
| 202 | 202 |
| 203 const int16_t* output_data = output_.data(); |
| 204 const int16_t* output_internal_data = output_internal_.data(); |
| 203 for (size_t i = 0; i < output_.samples_per_channel_; ++i) { | 205 for (size_t i = 0; i < output_.samples_per_channel_; ++i) { |
| 204 ASSERT_EQ(output_.data_[i], output_internal_.data_[i]) | 206 ASSERT_EQ(output_data[i], output_internal_data[i]) |
| 205 << "Diff in sample " << i << "."; | 207 << "Diff in sample " << i << "."; |
| 206 } | 208 } |
| 207 } | 209 } |
| 208 | 210 |
| 209 void InsertPacket(RTPHeader rtp_header, | 211 void InsertPacket(RTPHeader rtp_header, |
| 210 rtc::ArrayView<const uint8_t> payload, | 212 rtc::ArrayView<const uint8_t> payload, |
| 211 uint32_t receive_timestamp) override { | 213 uint32_t receive_timestamp) override { |
| 212 // Insert packet in internal decoder. | 214 // Insert packet in internal decoder. |
| 213 ASSERT_EQ(NetEq::kOK, neteq_internal_->InsertPacket(rtp_header, payload, | 215 ASSERT_EQ(NetEq::kOK, neteq_internal_->InsertPacket(rtp_header, payload, |
| 214 receive_timestamp)); | 216 receive_timestamp)); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 AudioFrame output; | 293 AudioFrame output; |
| 292 GetOutputAudio(&output); | 294 GetOutputAudio(&output); |
| 293 UpdateState(output.speech_type_); | 295 UpdateState(output.speech_type_); |
| 294 | 296 |
| 295 if (test_state_ == kExpandPhase || test_state_ == kFadedExpandPhase) { | 297 if (test_state_ == kExpandPhase || test_state_ == kFadedExpandPhase) { |
| 296 // Don't verify the output in this phase of the test. | 298 // Don't verify the output in this phase of the test. |
| 297 return; | 299 return; |
| 298 } | 300 } |
| 299 | 301 |
| 300 ASSERT_EQ(1u, output.num_channels_); | 302 ASSERT_EQ(1u, output.num_channels_); |
| 303 const int16_t* output_data = output.data(); |
| 301 for (size_t i = 0; i < output.samples_per_channel_; ++i) { | 304 for (size_t i = 0; i < output.samples_per_channel_; ++i) { |
| 302 if (output.data_[i] != 0) | 305 if (output_data[i] != 0) |
| 303 return; | 306 return; |
| 304 } | 307 } |
| 305 EXPECT_TRUE(false) | 308 EXPECT_TRUE(false) |
| 306 << "Expected at least one non-zero sample in each output block."; | 309 << "Expected at least one non-zero sample in each output block."; |
| 307 } | 310 } |
| 308 | 311 |
| 309 int NumExpectedDecodeCalls(int num_loops) override { | 312 int NumExpectedDecodeCalls(int num_loops) override { |
| 310 // Some packets at the end of the stream won't be decoded. When the jump in | 313 // Some packets at the end of the stream won't be decoded. When the jump in |
| 311 // timestamp happens, NetEq will do Expand during one GetAudio call. In the | 314 // timestamp happens, NetEq will do Expand during one GetAudio call. In the |
| 312 // next call it will decode the packet after the jump, but the net result is | 315 // next call it will decode the packet after the jump, but the net result is |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 kStartSeqeunceNumber, | 448 kStartSeqeunceNumber, |
| 446 kStartTimestamp, | 449 kStartTimestamp, |
| 447 kJumpFromTimestamp, | 450 kJumpFromTimestamp, |
| 448 kJumpToTimestamp)); | 451 kJumpToTimestamp)); |
| 449 | 452 |
| 450 RunTest(130); // Run 130 laps @ 10 ms each in the test loop. | 453 RunTest(130); // Run 130 laps @ 10 ms each in the test loop. |
| 451 EXPECT_EQ(kRecovered, test_state_); | 454 EXPECT_EQ(kRecovered, test_state_); |
| 452 } | 455 } |
| 453 | 456 |
| 454 } // namespace webrtc | 457 } // namespace webrtc |
| OLD | NEW |