OLD | NEW |
| (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_( | |
44 new ApmDataDumper(rtc::AtomicOps::Increment(&instance_count_))) {} | |
45 | |
46 BlockProcessorImpl::~BlockProcessorImpl() = default; | |
47 | |
48 void BlockProcessorImpl::ProcessCapture( | |
49 bool known_echo_path_change, | |
50 bool saturated_microphone_signal, | |
51 std::vector<std::vector<float>>* capture_block) { | |
52 RTC_DCHECK(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(render_block); | |
60 RTC_DCHECK_EQ(NumBandsForRate(sample_rate_hz_), render_block->size()); | |
61 RTC_DCHECK_EQ(kBlockSize, (*render_block)[0].size()); | |
62 return false; | |
63 } | |
64 | |
65 void BlockProcessorImpl::ReportEchoLeakage(bool leakage_detected) {} | |
66 | |
67 } // namespace | |
68 | |
69 BlockProcessor* BlockProcessor::Create(int sample_rate_hz) { | |
70 return new BlockProcessorImpl(sample_rate_hz); | |
71 } | |
72 | |
73 } // namespace webrtc | |
OLD | NEW |