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 : EchoCanceller3(sample_rate_hz, | 204 const AudioProcessing::Config::EchoCanceller3& config, |
205 int sample_rate_hz, | |
206 bool use_highpass_filter) | |
207 : EchoCanceller3(config, | |
208 sample_rate_hz, | |
205 use_highpass_filter, | 209 use_highpass_filter, |
206 std::unique_ptr<BlockProcessor>( | 210 std::unique_ptr<BlockProcessor>( |
207 BlockProcessor::Create(sample_rate_hz))) {} | 211 BlockProcessor::Create(config, sample_rate_hz))) {} |
208 EchoCanceller3::EchoCanceller3(int sample_rate_hz, | 212 EchoCanceller3::EchoCanceller3( |
209 bool use_highpass_filter, | 213 const AudioProcessing::Config::EchoCanceller3& config, |
ivoc
2017/06/30 11:40:03
This argument is also not used, Is it needed?
peah-webrtc
2017/06/30 13:20:16
No, you are totally right. Good point and find!
D
| |
210 std::unique_ptr<BlockProcessor> block_processor) | 214 int sample_rate_hz, |
215 bool use_highpass_filter, | |
216 std::unique_ptr<BlockProcessor> block_processor) | |
211 : data_dumper_( | 217 : data_dumper_( |
212 new ApmDataDumper(rtc::AtomicOps::Increment(&instance_count_))), | 218 new ApmDataDumper(rtc::AtomicOps::Increment(&instance_count_))), |
213 sample_rate_hz_(sample_rate_hz), | 219 sample_rate_hz_(sample_rate_hz), |
214 num_bands_(NumBandsForRate(sample_rate_hz_)), | 220 num_bands_(NumBandsForRate(sample_rate_hz_)), |
215 frame_length_(rtc::CheckedDivExact(LowestBandRate(sample_rate_hz_), 100)), | 221 frame_length_(rtc::CheckedDivExact(LowestBandRate(sample_rate_hz_), 100)), |
216 output_framer_(num_bands_), | 222 output_framer_(num_bands_), |
217 capture_blocker_(num_bands_), | 223 capture_blocker_(num_bands_), |
218 render_blocker_(num_bands_), | 224 render_blocker_(num_bands_), |
219 render_transfer_queue_( | 225 render_transfer_queue_( |
220 kRenderTransferQueueSize, | 226 kRenderTransferQueueSize, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
324 std::string EchoCanceller3::ToString( | 330 std::string EchoCanceller3::ToString( |
325 const AudioProcessing::Config::EchoCanceller3& config) { | 331 const AudioProcessing::Config::EchoCanceller3& config) { |
326 std::stringstream ss; | 332 std::stringstream ss; |
327 ss << "{" | 333 ss << "{" |
328 << "enabled: " << (config.enabled ? "true" : "false") << "}"; | 334 << "enabled: " << (config.enabled ? "true" : "false") << "}"; |
329 return ss.str(); | 335 return ss.str(); |
330 } | 336 } |
331 | 337 |
332 bool EchoCanceller3::Validate( | 338 bool EchoCanceller3::Validate( |
333 const AudioProcessing::Config::EchoCanceller3& config) { | 339 const AudioProcessing::Config::EchoCanceller3& config) { |
334 return true; | 340 return (config.echo_decay >= 0.f && config.echo_decay < 1.f); |
335 } | 341 } |
336 | 342 |
337 void EchoCanceller3::EmptyRenderQueue() { | 343 void EchoCanceller3::EmptyRenderQueue() { |
338 RTC_DCHECK_RUNS_SERIALIZED(&capture_race_checker_); | 344 RTC_DCHECK_RUNS_SERIALIZED(&capture_race_checker_); |
339 bool frame_to_buffer = | 345 bool frame_to_buffer = |
340 render_transfer_queue_.Remove(&render_queue_output_frame_); | 346 render_transfer_queue_.Remove(&render_queue_output_frame_); |
341 while (frame_to_buffer) { | 347 while (frame_to_buffer) { |
342 BufferRenderFrameContent(&render_queue_output_frame_, 0, &render_blocker_, | 348 BufferRenderFrameContent(&render_queue_output_frame_, 0, &render_blocker_, |
343 block_processor_.get(), &block_, &sub_frame_view_); | 349 block_processor_.get(), &block_, &sub_frame_view_); |
344 | 350 |
345 if (sample_rate_hz_ != 8000) { | 351 if (sample_rate_hz_ != 8000) { |
346 BufferRenderFrameContent(&render_queue_output_frame_, 1, &render_blocker_, | 352 BufferRenderFrameContent(&render_queue_output_frame_, 1, &render_blocker_, |
347 block_processor_.get(), &block_, | 353 block_processor_.get(), &block_, |
348 &sub_frame_view_); | 354 &sub_frame_view_); |
349 } | 355 } |
350 | 356 |
351 BufferRemainingRenderFrameContent(&render_blocker_, block_processor_.get(), | 357 BufferRemainingRenderFrameContent(&render_blocker_, block_processor_.get(), |
352 &block_); | 358 &block_); |
353 | 359 |
354 frame_to_buffer = | 360 frame_to_buffer = |
355 render_transfer_queue_.Remove(&render_queue_output_frame_); | 361 render_transfer_queue_.Remove(&render_queue_output_frame_); |
356 } | 362 } |
357 } | 363 } |
358 | 364 |
359 } // namespace webrtc | 365 } // namespace webrtc |
OLD | NEW |