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