blob: fa5ba8568940fb9b5f73e71efb105475f2747c55 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
bjornv@webrtc.org0c6f9312012-01-30 09:39:08 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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.org0c6f9312012-01-30 09:39:08 +000011#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_
12#define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
bjornv@webrtc.org91d11b32013-03-05 16:53:09 +000014#include "webrtc/modules/audio_processing/include/audio_processing.h"
15#include "webrtc/modules/audio_processing/processing_component.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000016
17namespace webrtc {
18class AudioProcessingImpl;
19class AudioBuffer;
20
21class EchoCancellationImpl : public EchoCancellation,
22 public ProcessingComponent {
23 public:
24 explicit EchoCancellationImpl(const AudioProcessingImpl* apm);
25 virtual ~EchoCancellationImpl();
26
27 int ProcessRenderAudio(const AudioBuffer* audio);
28 int ProcessCaptureAudio(AudioBuffer* audio);
29
30 // EchoCancellation implementation.
31 virtual bool is_enabled() const;
ajm@google.com808e0e02011-08-03 21:08:51 +000032 virtual int device_sample_rate_hz() const;
33 virtual int stream_drift_samples() const;
niklase@google.com470e71d2011-07-07 08:21:25 +000034
35 // ProcessingComponent implementation.
36 virtual int Initialize();
niklase@google.com470e71d2011-07-07 08:21:25 +000037
38 private:
39 // EchoCancellation implementation.
40 virtual int Enable(bool enable);
41 virtual int enable_drift_compensation(bool enable);
42 virtual bool is_drift_compensation_enabled() const;
43 virtual int set_device_sample_rate_hz(int rate);
andrew@webrtc.org6be1e932013-03-01 18:47:28 +000044 virtual void set_stream_drift_samples(int drift);
niklase@google.com470e71d2011-07-07 08:21:25 +000045 virtual int set_suppression_level(SuppressionLevel level);
46 virtual SuppressionLevel suppression_level() const;
47 virtual int enable_metrics(bool enable);
48 virtual bool are_metrics_enabled() const;
49 virtual bool stream_has_echo() const;
50 virtual int GetMetrics(Metrics* metrics);
bjornv@google.com1ba3dbe2011-10-03 08:18:10 +000051 virtual int enable_delay_logging(bool enable);
52 virtual bool is_delay_logging_enabled() const;
53 virtual int GetDelayMetrics(int* median, int* std);
bjornv@webrtc.org91d11b32013-03-05 16:53:09 +000054 virtual struct AecCore* aec_core() const;
niklase@google.com470e71d2011-07-07 08:21:25 +000055
56 // ProcessingComponent implementation.
57 virtual void* CreateHandle() const;
58 virtual int InitializeHandle(void* handle) const;
59 virtual int ConfigureHandle(void* handle) const;
60 virtual int DestroyHandle(void* handle) const;
61 virtual int num_handles_required() const;
62 virtual int GetHandleError(void* handle) const;
63
64 const AudioProcessingImpl* apm_;
65 bool drift_compensation_enabled_;
66 bool metrics_enabled_;
67 SuppressionLevel suppression_level_;
68 int device_sample_rate_hz_;
69 int stream_drift_samples_;
70 bool was_stream_drift_set_;
71 bool stream_has_echo_;
bjornv@google.com1ba3dbe2011-10-03 08:18:10 +000072 bool delay_logging_enabled_;
niklase@google.com470e71d2011-07-07 08:21:25 +000073};
74} // namespace webrtc
75
bjornv@webrtc.org0c6f9312012-01-30 09:39:08 +000076#endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_