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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 buffer_index += num_frames_per_band; | 148 buffer_index += num_frames_per_band; |
149 } | 149 } |
150 } | 150 } |
151 | 151 |
152 void EchoControlMobileImpl::PackRenderAudioBuffer( | 152 void EchoControlMobileImpl::PackRenderAudioBuffer( |
153 const AudioBuffer* audio, | 153 const AudioBuffer* audio, |
154 size_t num_output_channels, | 154 size_t num_output_channels, |
155 size_t num_channels, | 155 size_t num_channels, |
156 std::vector<int16_t>* packed_buffer) { | 156 std::vector<int16_t>* packed_buffer) { |
157 RTC_DCHECK_GE(160u, audio->num_frames_per_band()); | 157 RTC_DCHECK_GE(160, audio->num_frames_per_band()); |
158 RTC_DCHECK_EQ(num_channels, audio->num_channels()); | 158 RTC_DCHECK_EQ(num_channels, audio->num_channels()); |
159 | 159 |
160 // The ordering convention must be followed to pass to the correct AECM. | 160 // The ordering convention must be followed to pass to the correct AECM. |
161 packed_buffer->clear(); | 161 packed_buffer->clear(); |
162 int render_channel = 0; | 162 int render_channel = 0; |
163 for (size_t i = 0; i < num_output_channels; i++) { | 163 for (size_t i = 0; i < num_output_channels; i++) { |
164 for (size_t j = 0; j < audio->num_channels(); j++) { | 164 for (size_t j = 0; j < audio->num_channels(); j++) { |
165 // Buffer the samples in the render queue. | 165 // Buffer the samples in the render queue. |
166 packed_buffer->insert( | 166 packed_buffer->insert( |
167 packed_buffer->end(), | 167 packed_buffer->end(), |
(...skipping 12 matching lines...) Expand all Loading... |
180 } | 180 } |
181 | 181 |
182 int EchoControlMobileImpl::ProcessCaptureAudio(AudioBuffer* audio, | 182 int EchoControlMobileImpl::ProcessCaptureAudio(AudioBuffer* audio, |
183 int stream_delay_ms) { | 183 int stream_delay_ms) { |
184 rtc::CritScope cs_capture(crit_capture_); | 184 rtc::CritScope cs_capture(crit_capture_); |
185 if (!enabled_) { | 185 if (!enabled_) { |
186 return AudioProcessing::kNoError; | 186 return AudioProcessing::kNoError; |
187 } | 187 } |
188 | 188 |
189 RTC_DCHECK(stream_properties_); | 189 RTC_DCHECK(stream_properties_); |
190 RTC_DCHECK_GE(160u, audio->num_frames_per_band()); | 190 RTC_DCHECK_GE(160, audio->num_frames_per_band()); |
191 RTC_DCHECK_EQ(audio->num_channels(), stream_properties_->num_output_channels); | 191 RTC_DCHECK_EQ(audio->num_channels(), stream_properties_->num_output_channels); |
192 RTC_DCHECK_GE(cancellers_.size(), stream_properties_->num_reverse_channels * | 192 RTC_DCHECK_GE(cancellers_.size(), stream_properties_->num_reverse_channels * |
193 audio->num_channels()); | 193 audio->num_channels()); |
194 | 194 |
195 int err = AudioProcessing::kNoError; | 195 int err = AudioProcessing::kNoError; |
196 | 196 |
197 // The ordering convention must be followed to pass to the correct AECM. | 197 // The ordering convention must be followed to pass to the correct AECM. |
198 size_t handle_index = 0; | 198 size_t handle_index = 0; |
199 for (size_t capture = 0; capture < audio->num_channels(); ++capture) { | 199 for (size_t capture = 0; capture < audio->num_channels(); ++capture) { |
200 // TODO(ajm): improve how this works, possibly inside AECM. | 200 // TODO(ajm): improve how this works, possibly inside AECM. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 for (auto& canceller : cancellers_) { | 382 for (auto& canceller : cancellers_) { |
383 int handle_error = WebRtcAecm_set_config(canceller->state(), config); | 383 int handle_error = WebRtcAecm_set_config(canceller->state(), config); |
384 if (handle_error != AudioProcessing::kNoError) { | 384 if (handle_error != AudioProcessing::kNoError) { |
385 error = handle_error; | 385 error = handle_error; |
386 } | 386 } |
387 } | 387 } |
388 return error; | 388 return error; |
389 } | 389 } |
390 | 390 |
391 } // namespace webrtc | 391 } // namespace webrtc |
OLD | NEW |