blob: 3c2198cad5cd34459246627a037e823aaeacb629 [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
14#include "audio_processing.h"
15#include "processing_component.h"
16
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);
niklase@google.com470e71d2011-07-07 08:21:25 +000044 virtual int 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);
niklase@google.com470e71d2011-07-07 08:21:25 +000054
55 // ProcessingComponent implementation.
56 virtual void* CreateHandle() const;
57 virtual int InitializeHandle(void* handle) const;
58 virtual int ConfigureHandle(void* handle) const;
59 virtual int DestroyHandle(void* handle) const;
60 virtual int num_handles_required() const;
61 virtual int GetHandleError(void* handle) const;
62
63 const AudioProcessingImpl* apm_;
64 bool drift_compensation_enabled_;
65 bool metrics_enabled_;
66 SuppressionLevel suppression_level_;
67 int device_sample_rate_hz_;
68 int stream_drift_samples_;
69 bool was_stream_drift_set_;
70 bool stream_has_echo_;
bjornv@google.com1ba3dbe2011-10-03 08:18:10 +000071 bool delay_logging_enabled_;
niklase@google.com470e71d2011-07-07 08:21:25 +000072};
73} // namespace webrtc
74
bjornv@webrtc.org0c6f9312012-01-30 09:39:08 +000075#endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_