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