blob: 3ab0ce266892988b0d1b4f60b284f2fe2b903208 [file] [log] [blame]
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +00001/*
2 * Copyright (c) 2012 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
11#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_
12#define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_
13
andrew@webrtc.org25613ea2013-07-25 18:28:29 +000014#include "webrtc/modules/audio_processing/echo_cancellation_impl_wrapper.h"
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000015
16namespace webrtc {
andrew@webrtc.org25613ea2013-07-25 18:28:29 +000017
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000018class AudioProcessingImpl;
19class AudioBuffer;
20
andrew@webrtc.org25613ea2013-07-25 18:28:29 +000021class EchoCancellationImpl : public EchoCancellationImplWrapper {
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000022 public:
23 explicit EchoCancellationImpl(const AudioProcessingImpl* apm);
24 virtual ~EchoCancellationImpl();
25
andrew@webrtc.org25613ea2013-07-25 18:28:29 +000026 // EchoCancellationImplWrapper implementation.
pbos@webrtc.org24add922013-08-02 11:44:11 +000027 virtual int ProcessRenderAudio(const AudioBuffer* audio) OVERRIDE;
28 virtual int ProcessCaptureAudio(AudioBuffer* audio) OVERRIDE;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000029
30 // EchoCancellation implementation.
pbos@webrtc.org24add922013-08-02 11:44:11 +000031 virtual bool is_enabled() const OVERRIDE;
32 virtual int device_sample_rate_hz() const OVERRIDE;
33 virtual int stream_drift_samples() const OVERRIDE;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000034
35 // ProcessingComponent implementation.
pbos@webrtc.org24add922013-08-02 11:44:11 +000036 virtual int Initialize() OVERRIDE;
andrew@webrtc.org8ddec2c2013-09-25 23:17:38 +000037 virtual void SetExtraOptions(const Config& config) OVERRIDE;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000038
39 private:
40 // EchoCancellation implementation.
pbos@webrtc.org24add922013-08-02 11:44:11 +000041 virtual int Enable(bool enable) OVERRIDE;
42 virtual int enable_drift_compensation(bool enable) OVERRIDE;
43 virtual bool is_drift_compensation_enabled() const OVERRIDE;
44 virtual int set_device_sample_rate_hz(int rate) OVERRIDE;
45 virtual void set_stream_drift_samples(int drift) OVERRIDE;
46 virtual int set_suppression_level(SuppressionLevel level) OVERRIDE;
47 virtual SuppressionLevel suppression_level() const OVERRIDE;
48 virtual int enable_metrics(bool enable) OVERRIDE;
49 virtual bool are_metrics_enabled() const OVERRIDE;
50 virtual bool stream_has_echo() const OVERRIDE;
51 virtual int GetMetrics(Metrics* metrics) OVERRIDE;
52 virtual int enable_delay_logging(bool enable) OVERRIDE;
53 virtual bool is_delay_logging_enabled() const OVERRIDE;
54 virtual int GetDelayMetrics(int* median, int* std) OVERRIDE;
55 virtual struct AecCore* aec_core() const OVERRIDE;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000056
57 // ProcessingComponent implementation.
pbos@webrtc.org24add922013-08-02 11:44:11 +000058 virtual void* CreateHandle() const OVERRIDE;
59 virtual int InitializeHandle(void* handle) const OVERRIDE;
60 virtual int ConfigureHandle(void* handle) const OVERRIDE;
61 virtual int DestroyHandle(void* handle) const OVERRIDE;
62 virtual int num_handles_required() const OVERRIDE;
63 virtual int GetHandleError(void* handle) const OVERRIDE;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000064
65 const AudioProcessingImpl* apm_;
66 bool drift_compensation_enabled_;
67 bool metrics_enabled_;
68 SuppressionLevel suppression_level_;
69 int device_sample_rate_hz_;
70 int stream_drift_samples_;
71 bool was_stream_drift_set_;
72 bool stream_has_echo_;
73 bool delay_logging_enabled_;
andrew@webrtc.org8ddec2c2013-09-25 23:17:38 +000074 bool delay_correction_enabled_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000075};
andrew@webrtc.org25613ea2013-07-25 18:28:29 +000076
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000077} // namespace webrtc
78
79#endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_