Chromium Code Reviews| Index: webrtc/modules/audio_processing/aec3/block_processor.cc |
| diff --git a/webrtc/modules/audio_processing/aec3/block_processor.cc b/webrtc/modules/audio_processing/aec3/block_processor.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8347feb5023cac189c68d7e9e4271a7007da6ca8 |
| --- /dev/null |
| +++ b/webrtc/modules/audio_processing/aec3/block_processor.cc |
| @@ -0,0 +1,72 @@ |
| +/* |
| + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| +#include "webrtc/modules/audio_processing/aec3/block_processor.h" |
| + |
| +#include "webrtc/base/atomicops.h" |
| +#include "webrtc/base/optional.h" |
| +#include "webrtc/modules/audio_processing/aec3/aec3_constants.h" |
| + |
| +namespace webrtc { |
| +namespace { |
| + |
| +class BlockProcessorImpl final : public BlockProcessor { |
| + public: |
| + explicit BlockProcessorImpl(int sample_rate_hz); |
| + ~BlockProcessorImpl() override; |
| + |
| + void ProcessCapture(bool known_echo_path_change, |
| + bool saturated_microphone_signal, |
| + std::vector<std::vector<float>>* capture_block) override; |
| + |
| + bool BufferRender(std::vector<std::vector<float>>* block) override; |
| + |
| + void ReportEchoLeakage(bool leakage_detected) override; |
| + |
| + private: |
| + const size_t sample_rate_hz_; |
| + static int instance_count_; |
| + std::unique_ptr<ApmDataDumper> data_dumper_; |
| + RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(BlockProcessorImpl); |
| +}; |
| + |
| +int BlockProcessorImpl::instance_count_ = 0; |
| + |
| +BlockProcessorImpl::BlockProcessorImpl(int sample_rate_hz) |
| + : sample_rate_hz_(sample_rate_hz), |
| + data_dumper_(new ApmDataDumper(instance_count_)) { |
| + instance_count_ = rtc::AtomicOps::Increment(&instance_count_); |
|
ivoc
2016/12/23 10:32:33
If I understand correctly this is actually wrong.
hlundin-webrtc
2016/12/23 13:38:12
Oh! Good find! I didn't look into the declaration
peah-webrtc
2017/01/02 08:45:10
Great find and suggestion! Thanks!!!
Done.
peah-webrtc
2017/01/02 08:45:10
Acknowledged.
|
| +} |
| + |
| +BlockProcessorImpl::~BlockProcessorImpl() = default; |
| + |
| +void BlockProcessorImpl::ProcessCapture( |
| + bool known_echo_path_change, |
| + bool saturated_microphone_signal, |
| + std::vector<std::vector<float>>* capture_block) { |
| + RTC_DCHECK_EQ(NumBandsForRate(sample_rate_hz_), capture_block->size()); |
| + RTC_DCHECK_EQ(kBlockSize, (*capture_block)[0].size()); |
| +} |
| + |
| +bool BlockProcessorImpl::BufferRender( |
| + std::vector<std::vector<float>>* render_block) { |
| + RTC_DCHECK_EQ(NumBandsForRate(sample_rate_hz_), render_block->size()); |
| + RTC_DCHECK_EQ(kBlockSize, (*render_block)[0].size()); |
| + return false; |
| +} |
| + |
| +void BlockProcessorImpl::ReportEchoLeakage(bool leakage_detected) {} |
| + |
| +} // namespace |
| + |
| +BlockProcessor* BlockProcessor::Create(int sample_rate_hz) { |
| + return new BlockProcessorImpl(sample_rate_hz); |
| +} |
| + |
| +} // namespace webrtc |