| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 void SetUp() { | 166 void SetUp() { |
| 167 acm_.reset(AudioCodingModule::Create(id_, clock_)); | 167 acm_.reset(AudioCodingModule::Create(id_, clock_)); |
| 168 | 168 |
| 169 rtp_utility_->Populate(&rtp_header_); | 169 rtp_utility_->Populate(&rtp_header_); |
| 170 | 170 |
| 171 input_frame_.sample_rate_hz_ = kSampleRateHz; | 171 input_frame_.sample_rate_hz_ = kSampleRateHz; |
| 172 input_frame_.num_channels_ = 1; | 172 input_frame_.num_channels_ = 1; |
| 173 input_frame_.samples_per_channel_ = kSampleRateHz * 10 / 1000; // 10 ms. | 173 input_frame_.samples_per_channel_ = kSampleRateHz * 10 / 1000; // 10 ms. |
| 174 static_assert(kSampleRateHz * 10 / 1000 <= AudioFrame::kMaxDataSizeSamples, | 174 static_assert(kSampleRateHz * 10 / 1000 <= AudioFrame::kMaxDataSizeSamples, |
| 175 "audio frame too small"); | 175 "audio frame too small"); |
| 176 memset(input_frame_.data_, | 176 input_frame_.Mute(); |
| 177 0, | |
| 178 input_frame_.samples_per_channel_ * sizeof(input_frame_.data_[0])); | |
| 179 | 177 |
| 180 ASSERT_EQ(0, acm_->RegisterTransportCallback(&packet_cb_)); | 178 ASSERT_EQ(0, acm_->RegisterTransportCallback(&packet_cb_)); |
| 181 | 179 |
| 182 SetUpL16Codec(); | 180 SetUpL16Codec(); |
| 183 } | 181 } |
| 184 | 182 |
| 185 // Set up L16 codec. | 183 // Set up L16 codec. |
| 186 virtual void SetUpL16Codec() { | 184 virtual void SetUpL16Codec() { |
| 187 audio_format_ = | 185 audio_format_ = |
| 188 rtc::Optional<SdpAudioFormat>(SdpAudioFormat("L16", kSampleRateHz, 1)); | 186 rtc::Optional<SdpAudioFormat>(SdpAudioFormat("L16", kSampleRateHz, 1)); |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 ASSERT_EQ( | 687 ASSERT_EQ( |
| 690 0, | 688 0, |
| 691 acm_->IncomingPacket( | 689 acm_->IncomingPacket( |
| 692 &last_payload_vec_[0], last_payload_vec_.size(), rtp_header_)); | 690 &last_payload_vec_[0], last_payload_vec_.size(), rtp_header_)); |
| 693 } | 691 } |
| 694 | 692 |
| 695 void InsertAudio() override { | 693 void InsertAudio() override { |
| 696 // TODO(kwiberg): Use std::copy here. Might be complications because AFAICS | 694 // TODO(kwiberg): Use std::copy here. Might be complications because AFAICS |
| 697 // this call confuses the number of samples with the number of bytes, and | 695 // this call confuses the number of samples with the number of bytes, and |
| 698 // ends up copying only half of what it should. | 696 // ends up copying only half of what it should. |
| 699 memcpy(input_frame_.data_, audio_loop_.GetNextBlock().data(), | 697 memcpy(input_frame_.mutable_data(), audio_loop_.GetNextBlock().data(), |
| 700 kNumSamples10ms); | 698 kNumSamples10ms); |
| 701 AudioCodingModuleTestOldApi::InsertAudio(); | 699 AudioCodingModuleTestOldApi::InsertAudio(); |
| 702 } | 700 } |
| 703 | 701 |
| 704 // Override the verification function with no-op, since iSAC produces variable | 702 // Override the verification function with no-op, since iSAC produces variable |
| 705 // payload sizes. | 703 // payload sizes. |
| 706 void VerifyEncoding() override {} | 704 void VerifyEncoding() override {} |
| 707 | 705 |
| 708 // This method is the same as AudioCodingModuleMtTestOldApi::TestDone(), but | 706 // This method is the same as AudioCodingModuleMtTestOldApi::TestDone(), but |
| 709 // here it is using the constants defined in this class (i.e., shorter test | 707 // here it is using the constants defined in this class (i.e., shorter test |
| (...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 Run(16000, 8000, 1000); | 1837 Run(16000, 8000, 1000); |
| 1840 } | 1838 } |
| 1841 | 1839 |
| 1842 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { | 1840 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { |
| 1843 Run(8000, 16000, 1000); | 1841 Run(8000, 16000, 1000); |
| 1844 } | 1842 } |
| 1845 | 1843 |
| 1846 #endif | 1844 #endif |
| 1847 | 1845 |
| 1848 } // namespace webrtc | 1846 } // namespace webrtc |
| OLD | NEW |