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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 rtc::CritScope cs_capture(crit_capture_); | 144 rtc::CritScope cs_capture(crit_capture_); |
145 if (!enabled_) { | 145 if (!enabled_) { |
146 return AudioProcessing::kNoError; | 146 return AudioProcessing::kNoError; |
147 } | 147 } |
148 | 148 |
149 if (drift_compensation_enabled_ && !was_stream_drift_set_) { | 149 if (drift_compensation_enabled_ && !was_stream_drift_set_) { |
150 return AudioProcessing::kStreamParameterNotSetError; | 150 return AudioProcessing::kStreamParameterNotSetError; |
151 } | 151 } |
152 | 152 |
153 RTC_DCHECK(stream_properties_); | 153 RTC_DCHECK(stream_properties_); |
154 RTC_DCHECK_GE(160u, audio->num_frames_per_band()); | 154 RTC_DCHECK_GE(160, audio->num_frames_per_band()); |
155 RTC_DCHECK_EQ(audio->num_channels(), stream_properties_->num_proc_channels); | 155 RTC_DCHECK_EQ(audio->num_channels(), stream_properties_->num_proc_channels); |
156 | 156 |
157 int err = AudioProcessing::kNoError; | 157 int err = AudioProcessing::kNoError; |
158 | 158 |
159 // The ordering convention must be followed to pass to the correct AEC. | 159 // The ordering convention must be followed to pass to the correct AEC. |
160 size_t handle_index = 0; | 160 size_t handle_index = 0; |
161 stream_has_echo_ = false; | 161 stream_has_echo_ = false; |
162 for (size_t i = 0; i < audio->num_channels(); i++) { | 162 for (size_t i = 0; i < audio->num_channels(); i++) { |
163 for (size_t j = 0; j < stream_properties_->num_reverse_channels; j++) { | 163 for (size_t j = 0; j < stream_properties_->num_reverse_channels; j++) { |
164 err = WebRtcAec_Process( | 164 err = WebRtcAec_Process( |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 // Report the delay for the first AEC component. | 443 // Report the delay for the first AEC component. |
444 return WebRtcAec_system_delay( | 444 return WebRtcAec_system_delay( |
445 WebRtcAec_aec_core(cancellers_[0]->state())); | 445 WebRtcAec_aec_core(cancellers_[0]->state())); |
446 } | 446 } |
447 | 447 |
448 void EchoCancellationImpl::PackRenderAudioBuffer( | 448 void EchoCancellationImpl::PackRenderAudioBuffer( |
449 const AudioBuffer* audio, | 449 const AudioBuffer* audio, |
450 size_t num_output_channels, | 450 size_t num_output_channels, |
451 size_t num_channels, | 451 size_t num_channels, |
452 std::vector<float>* packed_buffer) { | 452 std::vector<float>* packed_buffer) { |
453 RTC_DCHECK_GE(160u, audio->num_frames_per_band()); | 453 RTC_DCHECK_GE(160, audio->num_frames_per_band()); |
454 RTC_DCHECK_EQ(num_channels, audio->num_channels()); | 454 RTC_DCHECK_EQ(num_channels, audio->num_channels()); |
455 | 455 |
456 packed_buffer->clear(); | 456 packed_buffer->clear(); |
457 // The ordering convention must be followed to pass the correct data. | 457 // The ordering convention must be followed to pass the correct data. |
458 for (size_t i = 0; i < num_output_channels; i++) { | 458 for (size_t i = 0; i < num_output_channels; i++) { |
459 for (size_t j = 0; j < audio->num_channels(); j++) { | 459 for (size_t j = 0; j < audio->num_channels(); j++) { |
460 // Buffer the samples in the render queue. | 460 // Buffer the samples in the render queue. |
461 packed_buffer->insert(packed_buffer->end(), | 461 packed_buffer->insert(packed_buffer->end(), |
462 audio->split_bands_const_f(j)[kBand0To8kHz], | 462 audio->split_bands_const_f(j)[kBand0To8kHz], |
463 (audio->split_bands_const_f(j)[kBand0To8kHz] + | 463 (audio->split_bands_const_f(j)[kBand0To8kHz] + |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 return error; | 506 return error; |
507 } | 507 } |
508 | 508 |
509 size_t EchoCancellationImpl::NumCancellersRequired( | 509 size_t EchoCancellationImpl::NumCancellersRequired( |
510 size_t num_output_channels, | 510 size_t num_output_channels, |
511 size_t num_reverse_channels) { | 511 size_t num_reverse_channels) { |
512 return num_output_channels * num_reverse_channels; | 512 return num_output_channels * num_reverse_channels; |
513 } | 513 } |
514 | 514 |
515 } // namespace webrtc | 515 } // namespace webrtc |
OLD | NEW |