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 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 ++seq_no; | 1514 ++seq_no; |
1515 timestamp += kCngPeriodSamples; | 1515 timestamp += kCngPeriodSamples; |
1516 | 1516 |
1517 // Pull audio once and make sure CNG is played. | 1517 // Pull audio once and make sure CNG is played. |
1518 bool muted; | 1518 bool muted; |
1519 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); | 1519 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); |
1520 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); | 1520 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); |
1521 EXPECT_EQ(AudioFrame::kCNG, out_frame_.speech_type_); | 1521 EXPECT_EQ(AudioFrame::kCNG, out_frame_.speech_type_); |
1522 | 1522 |
1523 // Insert some speech packets. | 1523 // Insert some speech packets. |
1524 for (int i = 0; i < 3; ++i) { | 1524 const uint32_t first_speech_timestamp = timestamp; |
| 1525 int timeout_counter = 0; |
| 1526 do { |
| 1527 ASSERT_LT(timeout_counter++, 20) << "Test timed out"; |
1525 PopulateRtpInfo(seq_no, timestamp, &rtp_info); | 1528 PopulateRtpInfo(seq_no, timestamp, &rtp_info); |
1526 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); | 1529 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); |
1527 ++seq_no; | 1530 ++seq_no; |
1528 timestamp += kSamples; | 1531 timestamp += kSamples; |
1529 | 1532 |
1530 // Pull audio once. | 1533 // Pull audio once. |
1531 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); | 1534 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); |
1532 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); | 1535 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); |
1533 } | 1536 } while (!IsNewerTimestamp(out_frame_.timestamp_, first_speech_timestamp)); |
1534 // Verify speech output. | 1537 // Verify speech output. |
1535 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_); | 1538 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_); |
1536 } | 1539 } |
1537 | 1540 |
1538 class NetEqDecodingTestWithMutedState : public NetEqDecodingTest { | 1541 class NetEqDecodingTestWithMutedState : public NetEqDecodingTest { |
1539 public: | 1542 public: |
1540 NetEqDecodingTestWithMutedState() : NetEqDecodingTest() { | 1543 NetEqDecodingTestWithMutedState() : NetEqDecodingTest() { |
1541 config_.enable_muted_state = true; | 1544 config_.enable_muted_state = true; |
1542 } | 1545 } |
1543 | 1546 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1779 if (muted) { | 1782 if (muted) { |
1780 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2)); | 1783 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2)); |
1781 } else { | 1784 } else { |
1782 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2)); | 1785 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2)); |
1783 } | 1786 } |
1784 } | 1787 } |
1785 EXPECT_FALSE(muted); | 1788 EXPECT_FALSE(muted); |
1786 } | 1789 } |
1787 | 1790 |
1788 } // namespace webrtc | 1791 } // namespace webrtc |
OLD | NEW |