OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 #include "webrtc/modules/audio_processing/aec3/echo_canceller3.h" | 10 #include "webrtc/modules/audio_processing/aec3/echo_canceller3.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 if (render_highpass_filter_) { | 194 if (render_highpass_filter_) { |
195 render_highpass_filter_->Process(render_queue_input_frame_[0]); | 195 render_highpass_filter_->Process(render_queue_input_frame_[0]); |
196 } | 196 } |
197 | 197 |
198 static_cast<void>(render_transfer_queue_->Insert(&render_queue_input_frame_)); | 198 static_cast<void>(render_transfer_queue_->Insert(&render_queue_input_frame_)); |
199 } | 199 } |
200 | 200 |
201 int EchoCanceller3::instance_count_ = 0; | 201 int EchoCanceller3::instance_count_ = 0; |
202 | 202 |
203 EchoCanceller3::EchoCanceller3(int sample_rate_hz, bool use_highpass_filter) | 203 EchoCanceller3::EchoCanceller3( |
| 204 const AudioProcessing::Config::EchoCanceller3& config, |
| 205 int sample_rate_hz, |
| 206 bool use_highpass_filter) |
204 : EchoCanceller3(sample_rate_hz, | 207 : EchoCanceller3(sample_rate_hz, |
205 use_highpass_filter, | 208 use_highpass_filter, |
206 std::unique_ptr<BlockProcessor>( | 209 std::unique_ptr<BlockProcessor>( |
207 BlockProcessor::Create(sample_rate_hz))) {} | 210 BlockProcessor::Create(config, sample_rate_hz))) {} |
208 EchoCanceller3::EchoCanceller3(int sample_rate_hz, | 211 EchoCanceller3::EchoCanceller3(int sample_rate_hz, |
209 bool use_highpass_filter, | 212 bool use_highpass_filter, |
210 std::unique_ptr<BlockProcessor> block_processor) | 213 std::unique_ptr<BlockProcessor> block_processor) |
211 : data_dumper_( | 214 : data_dumper_( |
212 new ApmDataDumper(rtc::AtomicOps::Increment(&instance_count_))), | 215 new ApmDataDumper(rtc::AtomicOps::Increment(&instance_count_))), |
213 sample_rate_hz_(sample_rate_hz), | 216 sample_rate_hz_(sample_rate_hz), |
214 num_bands_(NumBandsForRate(sample_rate_hz_)), | 217 num_bands_(NumBandsForRate(sample_rate_hz_)), |
215 frame_length_(rtc::CheckedDivExact(LowestBandRate(sample_rate_hz_), 100)), | 218 frame_length_(rtc::CheckedDivExact(LowestBandRate(sample_rate_hz_), 100)), |
216 output_framer_(num_bands_), | 219 output_framer_(num_bands_), |
217 capture_blocker_(num_bands_), | 220 capture_blocker_(num_bands_), |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 std::string EchoCanceller3::ToString( | 327 std::string EchoCanceller3::ToString( |
325 const AudioProcessing::Config::EchoCanceller3& config) { | 328 const AudioProcessing::Config::EchoCanceller3& config) { |
326 std::stringstream ss; | 329 std::stringstream ss; |
327 ss << "{" | 330 ss << "{" |
328 << "enabled: " << (config.enabled ? "true" : "false") << "}"; | 331 << "enabled: " << (config.enabled ? "true" : "false") << "}"; |
329 return ss.str(); | 332 return ss.str(); |
330 } | 333 } |
331 | 334 |
332 bool EchoCanceller3::Validate( | 335 bool EchoCanceller3::Validate( |
333 const AudioProcessing::Config::EchoCanceller3& config) { | 336 const AudioProcessing::Config::EchoCanceller3& config) { |
334 return true; | 337 return (config.echo_decay >= 0.f && config.echo_decay < 1.f); |
335 } | 338 } |
336 | 339 |
337 void EchoCanceller3::EmptyRenderQueue() { | 340 void EchoCanceller3::EmptyRenderQueue() { |
338 RTC_DCHECK_RUNS_SERIALIZED(&capture_race_checker_); | 341 RTC_DCHECK_RUNS_SERIALIZED(&capture_race_checker_); |
339 bool frame_to_buffer = | 342 bool frame_to_buffer = |
340 render_transfer_queue_.Remove(&render_queue_output_frame_); | 343 render_transfer_queue_.Remove(&render_queue_output_frame_); |
341 while (frame_to_buffer) { | 344 while (frame_to_buffer) { |
342 BufferRenderFrameContent(&render_queue_output_frame_, 0, &render_blocker_, | 345 BufferRenderFrameContent(&render_queue_output_frame_, 0, &render_blocker_, |
343 block_processor_.get(), &block_, &sub_frame_view_); | 346 block_processor_.get(), &block_, &sub_frame_view_); |
344 | 347 |
345 if (sample_rate_hz_ != 8000) { | 348 if (sample_rate_hz_ != 8000) { |
346 BufferRenderFrameContent(&render_queue_output_frame_, 1, &render_blocker_, | 349 BufferRenderFrameContent(&render_queue_output_frame_, 1, &render_blocker_, |
347 block_processor_.get(), &block_, | 350 block_processor_.get(), &block_, |
348 &sub_frame_view_); | 351 &sub_frame_view_); |
349 } | 352 } |
350 | 353 |
351 BufferRemainingRenderFrameContent(&render_blocker_, block_processor_.get(), | 354 BufferRemainingRenderFrameContent(&render_blocker_, block_processor_.get(), |
352 &block_); | 355 &block_); |
353 | 356 |
354 frame_to_buffer = | 357 frame_to_buffer = |
355 render_transfer_queue_.Remove(&render_queue_output_frame_); | 358 render_transfer_queue_.Remove(&render_queue_output_frame_); |
356 } | 359 } |
357 } | 360 } |
358 | 361 |
359 } // namespace webrtc | 362 } // namespace webrtc |
OLD | NEW |