niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
bjornv@webrtc.org | 0c6f931 | 2012-01-30 09:39:08 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | |
bjornv@webrtc.org | 0c6f931 | 2012-01-30 09:39:08 +0000 | [diff] [blame] | 11 | #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_ |
| 12 | #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
andrew@webrtc.org | 56e4a05 | 2014-02-27 22:23:17 +0000 | [diff] [blame] | 14 | #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 15 | #include "webrtc/modules/audio_processing/processing_component.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 16 | |
| 17 | namespace webrtc { |
andrew@webrtc.org | 61e596f | 2013-07-25 18:28:29 +0000 | [diff] [blame] | 18 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 19 | class AudioBuffer; |
andrew@webrtc.org | 56e4a05 | 2014-02-27 22:23:17 +0000 | [diff] [blame] | 20 | class CriticalSectionWrapper; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 21 | |
andrew@webrtc.org | 56e4a05 | 2014-02-27 22:23:17 +0000 | [diff] [blame] | 22 | class EchoCancellationImpl : public EchoCancellation, |
| 23 | public ProcessingComponent { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 24 | public: |
andrew@webrtc.org | 56e4a05 | 2014-02-27 22:23:17 +0000 | [diff] [blame] | 25 | EchoCancellationImpl(const AudioProcessing* apm, |
| 26 | CriticalSectionWrapper* crit); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | virtual ~EchoCancellationImpl(); |
| 28 | |
andrew@webrtc.org | 56e4a05 | 2014-02-27 22:23:17 +0000 | [diff] [blame] | 29 | int ProcessRenderAudio(const AudioBuffer* audio); |
| 30 | int ProcessCaptureAudio(AudioBuffer* audio); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 31 | |
| 32 | // EchoCancellation implementation. |
pbos@webrtc.org | 9162080 | 2013-08-02 11:44:11 +0000 | [diff] [blame] | 33 | virtual bool is_enabled() const OVERRIDE; |
| 34 | virtual int device_sample_rate_hz() const OVERRIDE; |
| 35 | virtual int stream_drift_samples() const OVERRIDE; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 36 | |
| 37 | // ProcessingComponent implementation. |
pbos@webrtc.org | 9162080 | 2013-08-02 11:44:11 +0000 | [diff] [blame] | 38 | virtual int Initialize() OVERRIDE; |
andrew@webrtc.org | 1760a17 | 2013-09-25 23:17:38 +0000 | [diff] [blame] | 39 | virtual void SetExtraOptions(const Config& config) OVERRIDE; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 40 | |
| 41 | private: |
| 42 | // EchoCancellation implementation. |
pbos@webrtc.org | 9162080 | 2013-08-02 11:44:11 +0000 | [diff] [blame] | 43 | virtual int Enable(bool enable) OVERRIDE; |
| 44 | virtual int enable_drift_compensation(bool enable) OVERRIDE; |
| 45 | virtual bool is_drift_compensation_enabled() const OVERRIDE; |
| 46 | virtual int set_device_sample_rate_hz(int rate) OVERRIDE; |
| 47 | virtual void set_stream_drift_samples(int drift) OVERRIDE; |
| 48 | virtual int set_suppression_level(SuppressionLevel level) OVERRIDE; |
| 49 | virtual SuppressionLevel suppression_level() const OVERRIDE; |
| 50 | virtual int enable_metrics(bool enable) OVERRIDE; |
| 51 | virtual bool are_metrics_enabled() const OVERRIDE; |
| 52 | virtual bool stream_has_echo() const OVERRIDE; |
| 53 | virtual int GetMetrics(Metrics* metrics) OVERRIDE; |
| 54 | virtual int enable_delay_logging(bool enable) OVERRIDE; |
| 55 | virtual bool is_delay_logging_enabled() const OVERRIDE; |
| 56 | virtual int GetDelayMetrics(int* median, int* std) OVERRIDE; |
| 57 | virtual struct AecCore* aec_core() const OVERRIDE; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 58 | |
| 59 | // ProcessingComponent implementation. |
pbos@webrtc.org | 9162080 | 2013-08-02 11:44:11 +0000 | [diff] [blame] | 60 | virtual void* CreateHandle() const OVERRIDE; |
| 61 | virtual int InitializeHandle(void* handle) const OVERRIDE; |
| 62 | virtual int ConfigureHandle(void* handle) const OVERRIDE; |
bjornv@webrtc.org | 5964fe0 | 2014-04-22 06:52:28 +0000 | [diff] [blame^] | 63 | virtual void DestroyHandle(void* handle) const OVERRIDE; |
pbos@webrtc.org | 9162080 | 2013-08-02 11:44:11 +0000 | [diff] [blame] | 64 | virtual int num_handles_required() const OVERRIDE; |
| 65 | virtual int GetHandleError(void* handle) const OVERRIDE; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 66 | |
andrew@webrtc.org | 56e4a05 | 2014-02-27 22:23:17 +0000 | [diff] [blame] | 67 | const AudioProcessing* apm_; |
| 68 | CriticalSectionWrapper* crit_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 69 | bool drift_compensation_enabled_; |
| 70 | bool metrics_enabled_; |
| 71 | SuppressionLevel suppression_level_; |
| 72 | int device_sample_rate_hz_; |
| 73 | int stream_drift_samples_; |
| 74 | bool was_stream_drift_set_; |
| 75 | bool stream_has_echo_; |
bjornv@google.com | 1ba3dbe | 2011-10-03 08:18:10 +0000 | [diff] [blame] | 76 | bool delay_logging_enabled_; |
andrew@webrtc.org | 1760a17 | 2013-09-25 23:17:38 +0000 | [diff] [blame] | 77 | bool delay_correction_enabled_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 78 | }; |
andrew@webrtc.org | 61e596f | 2013-07-25 18:28:29 +0000 | [diff] [blame] | 79 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 80 | } // namespace webrtc |
| 81 | |
bjornv@webrtc.org | 0c6f931 | 2012-01-30 09:39:08 +0000 | [diff] [blame] | 82 | #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_ |