Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(818)

Unified Diff: webrtc/modules/audio_processing/aec3/block_processor.cc

Issue 2584493002: Added first layer of the echo canceller 3 functionality (Closed)
Patch Set: Disabled the BlockProcessor DEATH tests due to false alarms on the trybots Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..066e2f71ac1078ddaddfbfc8d28600a9853ec8b4
--- /dev/null
+++ b/webrtc/modules/audio_processing/aec3/block_processor.cc
@@ -0,0 +1,73 @@
+/*
+ * 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(rtc::AtomicOps::Increment(&instance_count_))) {}
+
+BlockProcessorImpl::~BlockProcessorImpl() = default;
+
+void BlockProcessorImpl::ProcessCapture(
+ bool known_echo_path_change,
+ bool saturated_microphone_signal,
+ std::vector<std::vector<float>>* capture_block) {
+ RTC_DCHECK(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(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

Powered by Google App Engine
This is Rietveld 408576698