Home | History | Annotate | Download | only in audio_processing
      1 /*
      2  *  Copyright (c) 2011 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_MAIN_SOURCE_ECHO_CANCELLATION_IMPL_H_
     12 #define WEBRTC_MODULES_AUDIO_PROCESSING_MAIN_SOURCE_ECHO_CANCELLATION_IMPL_H_
     13 
     14 #include "audio_processing.h"
     15 #include "processing_component.h"
     16 
     17 namespace webrtc {
     18 class AudioProcessingImpl;
     19 class AudioBuffer;
     20 
     21 class 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;
     32   virtual int device_sample_rate_hz() const;
     33   virtual int stream_drift_samples() const;
     34 
     35   // ProcessingComponent implementation.
     36   virtual int Initialize();
     37   virtual int get_version(char* version, int version_len_bytes) const;
     38 
     39  private:
     40   // EchoCancellation implementation.
     41   virtual int Enable(bool enable);
     42   virtual int enable_drift_compensation(bool enable);
     43   virtual bool is_drift_compensation_enabled() const;
     44   virtual int set_device_sample_rate_hz(int rate);
     45   virtual int set_stream_drift_samples(int drift);
     46   virtual int set_suppression_level(SuppressionLevel level);
     47   virtual SuppressionLevel suppression_level() const;
     48   virtual int enable_metrics(bool enable);
     49   virtual bool are_metrics_enabled() const;
     50   virtual bool stream_has_echo() const;
     51   virtual int GetMetrics(Metrics* metrics);
     52   virtual int enable_delay_logging(bool enable);
     53   virtual bool is_delay_logging_enabled() const;
     54   virtual int GetDelayMetrics(int* median, int* std);
     55 
     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_;
     72   bool delay_logging_enabled_;
     73 };
     74 }  // namespace webrtc
     75 
     76 #endif  // WEBRTC_MODULES_AUDIO_PROCESSING_MAIN_SOURCE_ECHO_CANCELLATION_IMPL_H_
     77