| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 last_packet_number_ = num_calls; | 649 last_packet_number_ = num_calls; |
| 650 } | 650 } |
| 651 ASSERT_GT(last_payload_vec_.size(), 0u); | 651 ASSERT_GT(last_payload_vec_.size(), 0u); |
| 652 ASSERT_EQ( | 652 ASSERT_EQ( |
| 653 0, | 653 0, |
| 654 acm_->IncomingPacket( | 654 acm_->IncomingPacket( |
| 655 &last_payload_vec_[0], last_payload_vec_.size(), rtp_header_)); | 655 &last_payload_vec_[0], last_payload_vec_.size(), rtp_header_)); |
| 656 } | 656 } |
| 657 | 657 |
| 658 void InsertAudio() { | 658 void InsertAudio() { |
| 659 memcpy(input_frame_.data_, audio_loop_.GetNextBlock(), kNumSamples10ms); | 659 // TODO(kwiberg): Use std::copy here. Might be complications because AFAICS |
| 660 // this call confuses the number of samples with the number of bytes, and |
| 661 // ends up copying only half of what it should. |
| 662 memcpy(input_frame_.data_, audio_loop_.GetNextBlock().data(), |
| 663 kNumSamples10ms); |
| 660 AudioCodingModuleTestOldApi::InsertAudio(); | 664 AudioCodingModuleTestOldApi::InsertAudio(); |
| 661 } | 665 } |
| 662 | 666 |
| 663 // Override the verification function with no-op, since iSAC produces variable | 667 // Override the verification function with no-op, since iSAC produces variable |
| 664 // payload sizes. | 668 // payload sizes. |
| 665 void VerifyEncoding() override {} | 669 void VerifyEncoding() override {} |
| 666 | 670 |
| 667 // This method is the same as AudioCodingModuleMtTestOldApi::TestDone(), but | 671 // This method is the same as AudioCodingModuleMtTestOldApi::TestDone(), but |
| 668 // here it is using the constants defined in this class (i.e., shorter test | 672 // here it is using the constants defined in this class (i.e., shorter test |
| 669 // run). | 673 // run). |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 CriticalSectionScoped lock(crit_sect_.get()); | 771 CriticalSectionScoped lock(crit_sect_.get()); |
| 768 if (clock_->TimeInMilliseconds() < next_insert_packet_time_ms_) { | 772 if (clock_->TimeInMilliseconds() < next_insert_packet_time_ms_) { |
| 769 return true; | 773 return true; |
| 770 } | 774 } |
| 771 next_insert_packet_time_ms_ += kPacketSizeMs; | 775 next_insert_packet_time_ms_ += kPacketSizeMs; |
| 772 ++receive_packet_count_; | 776 ++receive_packet_count_; |
| 773 | 777 |
| 774 // Encode new frame. | 778 // Encode new frame. |
| 775 uint32_t input_timestamp = rtp_header_.header.timestamp; | 779 uint32_t input_timestamp = rtp_header_.header.timestamp; |
| 776 while (info.encoded_bytes == 0) { | 780 while (info.encoded_bytes == 0) { |
| 777 info = isac_encoder_->Encode( | 781 info = |
| 778 input_timestamp, audio_loop_.GetNextBlock(), kNumSamples10ms, | 782 isac_encoder_->Encode(input_timestamp, audio_loop_.GetNextBlock(), |
| 779 max_encoded_bytes, encoded.get()); | 783 max_encoded_bytes, encoded.get()); |
| 780 input_timestamp += 160; // 10 ms at 16 kHz. | 784 input_timestamp += 160; // 10 ms at 16 kHz. |
| 781 } | 785 } |
| 782 EXPECT_EQ(rtp_header_.header.timestamp + kPacketSizeSamples, | 786 EXPECT_EQ(rtp_header_.header.timestamp + kPacketSizeSamples, |
| 783 input_timestamp); | 787 input_timestamp); |
| 784 EXPECT_EQ(rtp_header_.header.timestamp, info.encoded_timestamp); | 788 EXPECT_EQ(rtp_header_.header.timestamp, info.encoded_timestamp); |
| 785 EXPECT_EQ(rtp_header_.header.payloadType, info.payload_type); | 789 EXPECT_EQ(rtp_header_.header.payloadType, info.payload_type); |
| 786 } | 790 } |
| 787 // Now we're not holding the crit sect when calling ACM. | 791 // Now we're not holding the crit sect when calling ACM. |
| 788 | 792 |
| 789 // Insert into ACM. | 793 // Insert into ACM. |
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1759 Run(16000, 8000, 1000); | 1763 Run(16000, 8000, 1000); |
| 1760 } | 1764 } |
| 1761 | 1765 |
| 1762 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { | 1766 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { |
| 1763 Run(8000, 16000, 1000); | 1767 Run(8000, 16000, 1000); |
| 1764 } | 1768 } |
| 1765 | 1769 |
| 1766 #endif | 1770 #endif |
| 1767 | 1771 |
| 1768 } // namespace webrtc | 1772 } // namespace webrtc |
| OLD | NEW |