OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 // Verify first 64 samples of actual output. | 210 // Verify first 64 samples of actual output. |
211 const std::vector<int16_t> kOutput({ | 211 const std::vector<int16_t> kOutput({ |
212 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1578, -2816, -3460, -3403, -2709, -1594, | 212 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1578, -2816, -3460, -3403, -2709, -1594, |
213 -363, 671, 1269, 1328, 908, 202, -513, -964, -955, -431, 504, 1617, | 213 -363, 671, 1269, 1328, 908, 202, -513, -964, -955, -431, 504, 1617, |
214 2602, 3164, 3101, 2364, 1073, -511, -2047, -3198, -3721, -3525, -2688, | 214 2602, 3164, 3101, 2364, 1073, -511, -2047, -3198, -3721, -3525, -2688, |
215 -1440, -99, 1015, 1663, 1744, 1319, 588, -171, -680, -747, -315, 515, | 215 -1440, -99, 1015, 1663, 1744, 1319, 588, -171, -680, -747, -315, 515, |
216 1512, 2378, 2828, 2674, 1877, 568, -986, -2446, -3482, -3864, -3516, | 216 1512, 2378, 2828, 2674, 1877, 568, -986, -2446, -3482, -3864, -3516, |
217 -2534, -1163 }); | 217 -2534, -1163 }); |
218 ASSERT_GE(kMaxOutputSize, kOutput.size()); | 218 ASSERT_GE(kMaxOutputSize, kOutput.size()); |
219 EXPECT_TRUE(std::equal(kOutput.begin(), kOutput.end(), output.data_)); | 219 EXPECT_TRUE(std::equal(kOutput.begin(), kOutput.end(), output.data())); |
220 } | 220 } |
221 | 221 |
222 std::unique_ptr<NetEqImpl> neteq_; | 222 std::unique_ptr<NetEqImpl> neteq_; |
223 NetEq::Config config_; | 223 NetEq::Config config_; |
224 TickTimer* tick_timer_ = nullptr; | 224 TickTimer* tick_timer_ = nullptr; |
225 MockBufferLevelFilter* mock_buffer_level_filter_ = nullptr; | 225 MockBufferLevelFilter* mock_buffer_level_filter_ = nullptr; |
226 BufferLevelFilter* buffer_level_filter_ = nullptr; | 226 BufferLevelFilter* buffer_level_filter_ = nullptr; |
227 bool use_mock_buffer_level_filter_ = true; | 227 bool use_mock_buffer_level_filter_ = true; |
228 MockDecoderDatabase* mock_decoder_database_ = nullptr; | 228 MockDecoderDatabase* mock_decoder_database_ = nullptr; |
229 DecoderDatabase* decoder_database_ = nullptr; | 229 DecoderDatabase* decoder_database_ = nullptr; |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 // Start with a simple check that the fake decoder is behaving as expected. | 518 // Start with a simple check that the fake decoder is behaving as expected. |
519 EXPECT_EQ(kPayloadLengthSamples, | 519 EXPECT_EQ(kPayloadLengthSamples, |
520 static_cast<size_t>(decoder_.next_value() - 1)); | 520 static_cast<size_t>(decoder_.next_value() - 1)); |
521 | 521 |
522 // The value of the last of the output samples is the same as the number of | 522 // The value of the last of the output samples is the same as the number of |
523 // samples played from the decoded packet. Thus, this number + the RTP | 523 // samples played from the decoded packet. Thus, this number + the RTP |
524 // timestamp should match the playout timestamp. | 524 // timestamp should match the playout timestamp. |
525 // Wrap the expected value in an rtc::Optional to compare them as such. | 525 // Wrap the expected value in an rtc::Optional to compare them as such. |
526 EXPECT_EQ( | 526 EXPECT_EQ( |
527 rtc::Optional<uint32_t>(rtp_header.timestamp + | 527 rtc::Optional<uint32_t>(rtp_header.timestamp + |
528 output.data_[output.samples_per_channel_ - 1]), | 528 output.data()[output.samples_per_channel_ - 1]), |
529 neteq_->GetPlayoutTimestamp()); | 529 neteq_->GetPlayoutTimestamp()); |
530 | 530 |
531 // Check the timestamp for the last value in the sync buffer. This should | 531 // Check the timestamp for the last value in the sync buffer. This should |
532 // be one full frame length ahead of the RTP timestamp. | 532 // be one full frame length ahead of the RTP timestamp. |
533 const SyncBuffer* sync_buffer = neteq_->sync_buffer_for_test(); | 533 const SyncBuffer* sync_buffer = neteq_->sync_buffer_for_test(); |
534 ASSERT_TRUE(sync_buffer != NULL); | 534 ASSERT_TRUE(sync_buffer != NULL); |
535 EXPECT_EQ(rtp_header.timestamp + kPayloadLengthSamples, | 535 EXPECT_EQ(rtp_header.timestamp + kPayloadLengthSamples, |
536 sync_buffer->end_timestamp()); | 536 sync_buffer->end_timestamp()); |
537 | 537 |
538 // Check that the number of samples still to play from the sync buffer add | 538 // Check that the number of samples still to play from the sync buffer add |
539 // up with what was already played out. | 539 // up with what was already played out. |
540 EXPECT_EQ( | 540 EXPECT_EQ( |
541 kPayloadLengthSamples - output.data_[output.samples_per_channel_ - 1], | 541 kPayloadLengthSamples - output.data()[output.samples_per_channel_ - 1], |
542 sync_buffer->FutureLength()); | 542 sync_buffer->FutureLength()); |
543 } | 543 } |
544 | 544 |
545 TEST_F(NetEqImplTest, ReorderedPacket) { | 545 TEST_F(NetEqImplTest, ReorderedPacket) { |
546 UseNoMocks(); | 546 UseNoMocks(); |
547 CreateInstance(); | 547 CreateInstance(); |
548 | 548 |
549 const uint8_t kPayloadType = 17; // Just an arbitrary number. | 549 const uint8_t kPayloadType = 17; // Just an arbitrary number. |
550 const uint32_t kReceiveTime = 17; // Value doesn't matter for this test. | 550 const uint32_t kReceiveTime = 17; // Value doesn't matter for this test. |
551 const int kSampleRateHz = 8000; | 551 const int kSampleRateHz = 8000; |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1517 EXPECT_CALL(*mock_delay_manager_, BufferLimits(_, _)) | 1517 EXPECT_CALL(*mock_delay_manager_, BufferLimits(_, _)) |
1518 .Times(1) | 1518 .Times(1) |
1519 .WillOnce(DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2))); | 1519 .WillOnce(DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2))); |
1520 | 1520 |
1521 bool muted; | 1521 bool muted; |
1522 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output_, &muted)); | 1522 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output_, &muted)); |
1523 EXPECT_EQ(kAccelerate, neteq_->last_operation_for_test()); | 1523 EXPECT_EQ(kAccelerate, neteq_->last_operation_for_test()); |
1524 } | 1524 } |
1525 | 1525 |
1526 }// namespace webrtc | 1526 }// namespace webrtc |
OLD | NEW |