peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef MODULES_AUDIO_PROCESSING_AEC3_BLOCK_PROCESSOR_H_ |
| 12 | #define MODULES_AUDIO_PROCESSING_AEC3_BLOCK_PROCESSOR_H_ |
peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 13 | |
| 14 | #include <memory> |
| 15 | #include <vector> |
| 16 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 17 | #include "modules/audio_processing/aec3/echo_remover.h" |
| 18 | #include "modules/audio_processing/aec3/render_delay_buffer.h" |
| 19 | #include "modules/audio_processing/aec3/render_delay_controller.h" |
peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
| 22 | |
| 23 | // Class for performing echo cancellation on 64 sample blocks of audio data. |
| 24 | class BlockProcessor { |
| 25 | public: |
peah | 697a590 | 2017-06-30 07:06:10 -0700 | [diff] [blame] | 26 | static BlockProcessor* Create( |
| 27 | const AudioProcessing::Config::EchoCanceller3& config, |
| 28 | int sample_rate_hz); |
peah | 69221db | 2017-01-27 03:28:19 -0800 | [diff] [blame] | 29 | // Only used for testing purposes. |
| 30 | static BlockProcessor* Create( |
peah | 697a590 | 2017-06-30 07:06:10 -0700 | [diff] [blame] | 31 | const AudioProcessing::Config::EchoCanceller3& config, |
peah | 69221db | 2017-01-27 03:28:19 -0800 | [diff] [blame] | 32 | int sample_rate_hz, |
| 33 | std::unique_ptr<RenderDelayBuffer> render_buffer); |
| 34 | static BlockProcessor* Create( |
peah | 697a590 | 2017-06-30 07:06:10 -0700 | [diff] [blame] | 35 | const AudioProcessing::Config::EchoCanceller3& config, |
peah | 69221db | 2017-01-27 03:28:19 -0800 | [diff] [blame] | 36 | int sample_rate_hz, |
| 37 | std::unique_ptr<RenderDelayBuffer> render_buffer, |
| 38 | std::unique_ptr<RenderDelayController> delay_controller, |
| 39 | std::unique_ptr<EchoRemover> echo_remover); |
| 40 | |
peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 41 | virtual ~BlockProcessor() = default; |
| 42 | |
| 43 | // Processes a block of capture data. |
| 44 | virtual void ProcessCapture( |
peah | 69221db | 2017-01-27 03:28:19 -0800 | [diff] [blame] | 45 | bool echo_path_gain_change, |
| 46 | bool capture_signal_saturation, |
peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 47 | std::vector<std::vector<float>>* capture_block) = 0; |
| 48 | |
peah | cf02cf1 | 2017-04-05 14:18:07 -0700 | [diff] [blame] | 49 | // Buffers a block of render data supplied by a FrameBlocker object. |
| 50 | virtual void BufferRender( |
| 51 | const std::vector<std::vector<float>>& render_block) = 0; |
peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 52 | |
| 53 | // Reports whether echo leakage has been detected in the echo canceller |
| 54 | // output. |
peah | 69221db | 2017-01-27 03:28:19 -0800 | [diff] [blame] | 55 | virtual void UpdateEchoLeakageStatus(bool leakage_detected) = 0; |
peah | d026354 | 2017-01-03 04:20:34 -0800 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | } // namespace webrtc |
| 59 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 60 | #endif // MODULES_AUDIO_PROCESSING_AEC3_BLOCK_PROCESSOR_H_ |