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 | 10 |
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_BLOCK_PROCESSOR_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_BLOCK_PROCESSOR_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_BLOCK_PROCESSOR_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_BLOCK_PROCESSOR_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/base/constructormagic.h" | 17 #include "webrtc/modules/audio_processing/aec3/echo_remover.h" |
18 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" | 18 #include "webrtc/modules/audio_processing/aec3/render_delay_buffer.h" |
| 19 #include "webrtc/modules/audio_processing/aec3/render_delay_controller.h" |
19 | 20 |
20 namespace webrtc { | 21 namespace webrtc { |
21 | 22 |
22 // Class for performing echo cancellation on 64 sample blocks of audio data. | 23 // Class for performing echo cancellation on 64 sample blocks of audio data. |
23 class BlockProcessor { | 24 class BlockProcessor { |
24 public: | 25 public: |
25 static BlockProcessor* Create(int sample_rate_hz); | 26 static BlockProcessor* Create(int sample_rate_hz); |
| 27 // Only used for testing purposes. |
| 28 static BlockProcessor* Create( |
| 29 int sample_rate_hz, |
| 30 std::unique_ptr<RenderDelayBuffer> render_buffer); |
| 31 static BlockProcessor* Create( |
| 32 int sample_rate_hz, |
| 33 std::unique_ptr<RenderDelayBuffer> render_buffer, |
| 34 std::unique_ptr<RenderDelayController> delay_controller, |
| 35 std::unique_ptr<EchoRemover> echo_remover); |
| 36 |
26 virtual ~BlockProcessor() = default; | 37 virtual ~BlockProcessor() = default; |
27 | 38 |
28 // Processes a block of capture data. | 39 // Processes a block of capture data. |
29 virtual void ProcessCapture( | 40 virtual void ProcessCapture( |
30 bool known_echo_path_change, | 41 bool echo_path_gain_change, |
31 bool saturated_microphone_signal, | 42 bool capture_signal_saturation, |
32 std::vector<std::vector<float>>* capture_block) = 0; | 43 std::vector<std::vector<float>>* capture_block) = 0; |
33 | 44 |
34 // Buffers a block of render data supplied by a FrameBlocker object. | 45 // Buffers a block of render data supplied by a FrameBlocker object. Returns a |
| 46 // bool indicating the success of the buffering. |
35 virtual bool BufferRender(std::vector<std::vector<float>>* render_block) = 0; | 47 virtual bool BufferRender(std::vector<std::vector<float>>* render_block) = 0; |
36 | 48 |
37 // Reports whether echo leakage has been detected in the echo canceller | 49 // Reports whether echo leakage has been detected in the echo canceller |
38 // output. | 50 // output. |
39 virtual void ReportEchoLeakage(bool leakage_detected) = 0; | 51 virtual void UpdateEchoLeakageStatus(bool leakage_detected) = 0; |
40 }; | 52 }; |
41 | 53 |
42 } // namespace webrtc | 54 } // namespace webrtc |
43 | 55 |
44 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_BLOCK_PROCESSOR_H_ | 56 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_BLOCK_PROCESSOR_H_ |
OLD | NEW |