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

Side by Side Diff: webrtc/modules/audio_processing/aec3/block_processor.cc

Issue 2584493002: Added first layer of the echo canceller 3 functionality (Closed)
Patch Set: Added more crash tests 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10 #include "webrtc/modules/audio_processing/aec3/block_processor.h"
11
12 #include "webrtc/base/atomicops.h"
13 #include "webrtc/base/optional.h"
14 #include "webrtc/modules/audio_processing/aec3/aec3_constants.h"
15
16 namespace webrtc {
17 namespace {
18
19 class BlockProcessorImpl final : public BlockProcessor {
20 public:
21 explicit BlockProcessorImpl(int sample_rate_hz);
22 ~BlockProcessorImpl() override;
23
24 void ProcessCapture(bool known_echo_path_change,
25 bool saturated_microphone_signal,
26 std::vector<std::vector<float>>* capture_block) override;
27
28 bool BufferRender(std::vector<std::vector<float>>* block) override;
29
30 void ReportEchoLeakage(bool leakage_detected) override;
31
32 private:
33 const size_t sample_rate_hz_;
34 static int instance_count_;
35 std::unique_ptr<ApmDataDumper> data_dumper_;
36 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(BlockProcessorImpl);
37 };
38
39 int BlockProcessorImpl::instance_count_ = 0;
40
41 BlockProcessorImpl::BlockProcessorImpl(int sample_rate_hz)
42 : sample_rate_hz_(sample_rate_hz),
43 data_dumper_(new ApmDataDumper(instance_count_)) {
44 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.
45 }
46
47 BlockProcessorImpl::~BlockProcessorImpl() = default;
48
49 void BlockProcessorImpl::ProcessCapture(
50 bool known_echo_path_change,
51 bool saturated_microphone_signal,
52 std::vector<std::vector<float>>* capture_block) {
53 RTC_DCHECK_EQ(NumBandsForRate(sample_rate_hz_), capture_block->size());
54 RTC_DCHECK_EQ(kBlockSize, (*capture_block)[0].size());
55 }
56
57 bool BlockProcessorImpl::BufferRender(
58 std::vector<std::vector<float>>* render_block) {
59 RTC_DCHECK_EQ(NumBandsForRate(sample_rate_hz_), render_block->size());
60 RTC_DCHECK_EQ(kBlockSize, (*render_block)[0].size());
61 return false;
62 }
63
64 void BlockProcessorImpl::ReportEchoLeakage(bool leakage_detected) {}
65
66 } // namespace
67
68 BlockProcessor* BlockProcessor::Create(int sample_rate_hz) {
69 return new BlockProcessorImpl(sample_rate_hz);
70 }
71
72 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698